Skip to content

Commit

Permalink
add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
haseebzaki-07 committed Nov 4, 2024
1 parent 692f117 commit 08e1dc7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# docker-compose.yml

version: '3.8'

services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: backend
ports:
- "8080:8080"
depends_on:
- mongo

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: frontend
ports:
- "5173:5173"
depends_on:
- backend

mongo:
image: mongo:6
container_name: mongo
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db

volumes:
mongo-data:
22 changes: 22 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# backend/Dockerfile

# Base image for Node
FROM node:18

# 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 . .

# Expose port 5000 for the backend
EXPOSE 5000

# Start the backend with npm run dev
CMD ["npm", "run", "dev"]
22 changes: 22 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frontend/Dockerfile

# Base image for Node
FROM node:18

# 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 . .

# Expose port 3000 for the frontend
EXPOSE 5173

# Start the frontend with npm run dev
CMD ["npm", "run", "dev", "--", "--host"]

0 comments on commit 08e1dc7

Please sign in to comment.