-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 845 Bytes
/
Dockerfile
File metadata and controls
43 lines (29 loc) · 845 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
39
40
41
42
43
FROM node:21.1-alpine
# Create a new user and group in the container
RUN addgroup --system app && adduser --system --ingroup app app
# Change the user to the app user
USER app
# Set the working directory in the container
WORKDIR /app
# Copy the package.json and package-lock.json files to the working directory
COPY package*.json ./
# Copy pnpm-lock.yaml file to the working directory
COPY pnpm-lock.yaml ./
# Change the user to root
USER root
# Install pnpm
RUN npm install -g pnpm
# Change the owner of the working directory to the app user
RUN chown -R app:app /app
# Change the user to the app user
USER app
# Install the dependencies
RUN pnpm install
# Copy the source code to the working directory
COPY . .
# Build the application
RUN pnpm run build
# Expose the port
EXPOSE 3000
# Start the application
CMD ["pnpm", "start"]