Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerizing app, work in progress, donot merge yet #194

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Dockerizing app, work in progress
HanzallaUsman committed Dec 3, 2021
commit 774e1ecfa988c36a8e754c7829a73d60e4f9c064
5 changes: 5 additions & 0 deletions back-end/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
build
.dockerignore
Dockerfile
Dockerfile.prod
19 changes: 19 additions & 0 deletions back-end/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Base image
FROM node:16

# Set working directory so that all subsequent command runs in this folder
WORKDIR /back-end

# Copy package json and install dependencies
COPY package*.json ./
COPY package-lock.json ./

RUN npm install

# Copy our app
COPY . /back-end

# Expose port to access server
EXPOSE 3001
# Command to run our app
CMD [ "npm", "run", "devStart"]
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3"
services:
# Create frontend container
frontend: # Name of our service
build: ./front-end # path to dockerfile
ports: # Port binding to host from docker container
- "3000:3000" # Bind port 3000 of host to 3000 of container
container_name: frontend-docker
restart: always # What to do if container crashes
links:
- backend
# Create backend container
backend:
# Create backend container
build: ./back-end
ports:
- "3001:3001"
container_name: backend-docker
restart: always
links:
- db
# Create database container
db:
image: mongo
ports:
- "5432:5432"
container_name: database-docker
restart: always
5 changes: 5 additions & 0 deletions front-end/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
build
.dockerignore
Dockerfile
Dockerfile.prod
18 changes: 18 additions & 0 deletions front-end/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Base image
FROM node:16

# Set working directory so that all subsequent command runs in this folder
WORKDIR /front-end

# Copy package json and install dependencies
COPY package*.json ./
RUN npm install

# Copy our app
COPY . /front-end

# Expose port to access server
EXPOSE 3000

# Command to run our app
CMD [ "npm", "start" ]