-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 897 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (26 loc) · 897 Bytes
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
37
38
# Use an alpine Node.js runtime as a parent image
FROM node:14-alpine
# Set the working directory in the container for the client
WORKDIR /usr/src/app/client
# Copy the client package.json and package-lock.json
COPY client/package*.json ./
# Install the client dependencies
RUN npm install
# Copy the client source code
COPY client/ ./
# Build the client application
RUN npm run build
# Set the working directory in the container for the server
WORKDIR /usr/src/app/server
# Copy the server package.json and package-lock.json
COPY server/package*.json ./
# Install the server dependencies
RUN npm install
# Copy the server source code
COPY server/ ./
# Copy the client build files to the server's public directory
RUN mkdir -p ./public && cp -R /usr/src/app/client/dist/* ./public/
# Expose the port the server will run on
EXPOSE 5000
# Command to run the server
CMD ["npm", "start"]