forked from d-datta/MERN-BLOG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (25 loc) · 1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Use an official Node.js runtime as the base image
FROM node:16
# Copy package.json and package-lock.json files for both client and backend to /app in the container
COPY ./client/package*.json /app/client/
COPY ./backend/package*.json /app/backend/
# Set a working directory for the client within the container
WORKDIR /app/client
# Install client dependencies
RUN npm install
# Set a working directory for the backend within the container
WORKDIR /app/backend
# Install backend dependencies
RUN npm install
# Copy the entire project folder to /app in the container
COPY . /app/
# Set a working directory for the client within the container
WORKDIR /app/client
# Build the client application
RUN npm run build
# Set a working directory for the backend within the container
WORKDIR /app/backend
# Expose the port your Node.js server will listen on (replace 3000 with your server's port)
EXPOSE 5000
# Define the command to start your Node.js server (replace with your server's start command)
CMD ["npm", "start"]