-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create dockerfile for webapp project
- Loading branch information
1 parent
1a0ecb2
commit 121ebee
Showing
14 changed files
with
193 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: devcamper-webapi-loadbalancer-service | ||
namespace: devcamper-namespace | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- protocol: TCP | ||
port: 8081 | ||
targetPort: 5000 | ||
selector: | ||
app: devcamper-webapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ spec: | |
- protocol: TCP | ||
port: 80 | ||
targetPort: 5000 | ||
nodePort: 32018 | ||
nodePort: 32002 | ||
selector: | ||
app: devcamper-webapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: devcamper-webapp-configmap | ||
namespace: devcamper-namespace | ||
data: | ||
react_app_devcamper_base_api_uri: 'http://devcamper-webapi-nodeport-service.devcamper-namespace.svc.cluster.local:32002' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: devcamper-webapp-deployment | ||
namespace: devcamper-namespace | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: devcamper-webapp | ||
template: | ||
metadata: | ||
labels: | ||
app: devcamper-webapp | ||
spec: | ||
containers: | ||
- name: devcamper-webapp-container | ||
image: prasadhonrao/devcamper-webapp:latest | ||
ports: | ||
- containerPort: 3000 | ||
env: | ||
- name: REACT_APP_DEVCAMPER_BASE_API_URI | ||
valueFrom: | ||
configMapKeyRef: | ||
name: devcamper-webapp-configmap | ||
key: react_app_devcamper_base_api_uri | ||
resources: | ||
limits: | ||
memory: '2Gi' | ||
cpu: '2' | ||
requests: | ||
memory: '1Gi' | ||
cpu: '1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
#!bin/bash | ||
kubectl apply -f configmap.yaml | ||
kubectl apply -f deployment.yaml | ||
kubectl apply -f service-nodeport.yaml | ||
kubectl apply -f service-loadbalancer.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: devcamper-webapp-loadbalancer-service | ||
namespace: devcamper-namespace | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- protocol: TCP | ||
port: 8080 | ||
targetPort: 3000 | ||
selector: | ||
app: devcamper-webapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: devcamper-webapp-nodeport-service | ||
namespace: devcamper-namespace | ||
spec: | ||
type: NodePort | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 3000 | ||
nodePort: 32001 | ||
selector: | ||
app: devcamper-webapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
#!bin/bash | ||
kubectl delete -f configmap.yaml | ||
kubectl delete -f deployment.yaml | ||
kubectl delete -f service-nodeport.yaml | ||
kubectl delete -f service-loadbalancer.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Web App Configuration | ||
WEBAPP_PORT=3000 | ||
REACT_APP_DEVCAMPER_BASE_API_URI=http://localhost | ||
|
||
# Server configuration | ||
port=5000 | ||
node_env=development | ||
|
||
# Database configuration | ||
mongodb_host=localhost | ||
mongodb_port=27017 | ||
mongodb_username=admin | ||
mongodb_password=password | ||
mongodb_db_name=devcamper-db | ||
mongodb_db_params=authSource=admin | ||
|
||
# Geocoder configuration | ||
geocoder_provider=mapquest | ||
geocoder_api_key=m5SpLGTkplsHrlCYbX9Yj5LOiALoK5o1 | ||
|
||
# File upload configuration | ||
file_upload_path=../ui/public/images | ||
max_file_upload=1000000 | ||
|
||
# JWT configuration | ||
jwt_secret=jwt123 | ||
jwt_expire=30d | ||
jwt_cookie_expire=30 | ||
|
||
# Email configuration | ||
smtp_host=sandbox.smtp.mailtrap.io | ||
smtp_port=2525 | ||
smtp_email=b672b25167e875 | ||
smtp_password=208334e8a6a9d8 | ||
from_email=[email protected] | ||
from_name=DevCamper | ||
|
||
# Rate limiting configuration | ||
rate_limit_window=100 | ||
rate_limit_max=1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3.8' | ||
|
||
services: | ||
mongo: | ||
image: mongo | ||
container_name: devcamper-db | ||
ports: | ||
- 27017:27017 | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=admin | ||
- MONGO_INITDB_ROOT_PASSWORD=password | ||
volumes: | ||
- mongo-data:/data/db | ||
|
||
volumes: | ||
mongo-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Use the official Node.js image as the base image | ||
FROM node:14-alpine | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Set build-time environment variables | ||
ARG REACT_APP_DEVCAMPER_BASE_API_URI | ||
ENV REACT_APP_DEVCAMPER_BASE_API_URI=${REACT_APP_DEVCAMPER_BASE_API_URI} | ||
|
||
# Build the React application | ||
RUN npm run build | ||
|
||
# Install a simple HTTP server to serve the static files | ||
RUN npm install -g serve | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["serve", "-s", "build", "-l", "3000"] |