Skip to content

Commit

Permalink
Done with Dockerization
Browse files Browse the repository at this point in the history
  • Loading branch information
Pudi-Sravan committed Jul 3, 2024
1 parent cd09796 commit 8735530
Show file tree
Hide file tree
Showing 14 changed files with 904 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./node_modules
src/Back_end/node_modules
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:
frontend:
build:
context: .
dockerfile: dockerfile-frontend
ports:
- "5172:5173" # Expose frontend port 5173
environment:
- NODE_ENV=development
# Add other environment variables if necessary
depends_on:
- backend

backend:
build:
context: .
dockerfile: dockerfile-backend
ports:
- "3001:3001" # Expose backend port 3001
environment:
- NODE_ENV=development
# Add other environment variables if necessary
24 changes: 24 additions & 0 deletions dockerfile-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use Node.js LTS version as the base image
FROM node:lts-alpine

# Set the working directory for the backend in the container
WORKDIR /app/src/Back_end

# Copy only the backend package.json and lock file initially
COPY src/Back_end/package.json .
COPY src/Back_end/package-lock.json .

# Install all dependencies including devDependencies
RUN npm install --production=false

# Copy the rest of the backend application code
COPY src/Back_end .

# Copy backend-specific .env file (if needed)
COPY src/Back_end/.env .

# Expose the port on which the backend server will run
EXPOSE 3000

# Command to start the backend server
CMD ["npm", "run", "start"]
26 changes: 26 additions & 0 deletions dockerfile-frontend
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use Node.js LTS version as the base image
FROM node:lts-alpine

# Set the working directory for the frontend in the container
WORKDIR /app

# Copy only the root package.json and lock file initially
COPY package.json .
COPY package-lock.json .

# Install all dependencies including devDependencies
RUN npm install --production=false

# Copy the rest of the frontend application code
COPY src/Front_end ./src/Front_end

# Copy frontend-specific files
COPY ./.env .
COPY vite.config.js .
COPY index.html .

# Expose the port on which the frontend server will run
EXPOSE 5172

# Command to start the frontend server
CMD ["npm", "run", "dev"]
Loading

0 comments on commit 8735530

Please sign in to comment.