-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 911 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 911 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
# Start from the official LTS Node image.
FROM node:22 AS builder
WORKDIR /usr/src/app
# Copy the package files and download the dependencies.
# This is done before installing dependencies or copying code to leverage Docker cache layers.
COPY package*.json ./
# Copy the source code from the current directory to the working directory inside the container.
COPY . .
# Update npm to the latest version.
RUN npm install -g npm@latest
ENTRYPOINT [ "npm" ]
# Continue with the official LTS Node image to create a build artifact.
FROM node:22
WORKDIR /usr/src/app
# Copy application files from the base stage
COPY --from=builder /usr/src/app .
# Install only production dependencies from the lock file.
RUN npm ci --silent --production
EXPOSE 8080
# Define the entry point for the docker image.
# This is the command that will be run when the container starts.
ENTRYPOINT [ "npm" ]
CMD [ "run", "start" ]