-
Notifications
You must be signed in to change notification settings - Fork 497
/
Dockerfile
36 lines (26 loc) · 878 Bytes
/
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 the official Node.js runtime as a parent image
FROM node:20-alpine AS build
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install app dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application and clean up
RUN npm run build \
&& rm -rf node_modules \
&& npm install --omit=dev
# Use the official Node.js runtime as a parent image
FROM node:20-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the build directory, node_modules, and package.json to the working directory
COPY --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
# Expose port 8787
EXPOSE 8787
ENTRYPOINT ["npm"]
CMD ["run", "start:node"]