Skip to content

Commit

Permalink
Dockerfile Addn PR ( #189 ) from Hamza1821/addedDockerfiles
Browse files Browse the repository at this point in the history
added dockerfile and docker-compose
  • Loading branch information
4darsh-Dev authored Nov 10, 2024
2 parents a7976ef + 9e73578 commit d18be00
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
14 changes: 14 additions & 0 deletions backend/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# backend/Dockerfile
FROM node:18

WORKDIR /app

COPY package.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'

services:
backend:
build:
context: ./backend
ports:
- "3000:3000"
environment:
- NODE_ENV=production
volumes:
- ./backend:/app
depends_on:
- frontend

frontend:
build:
context: ./frontend
ports:
- "80:80"
environment:
- NODE_ENV=production
volumes:
- ./frontend:/app
20 changes: 20 additions & 0 deletions frontend/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frontend/Dockerfile
FROM node:18 AS build

WORKDIR /app

COPY package.json ./

RUN npm install

COPY . .

RUN npm run build

FROM nginx:stable-alpine AS production

COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

0 comments on commit d18be00

Please sign in to comment.