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

Add Docker Containerization #778

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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"]
Loading