-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (26 loc) · 704 Bytes
/
Dockerfile
File metadata and controls
28 lines (26 loc) · 704 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
# dependencies
FROM node:22.16.0-alpine AS dependencies
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN apk add --no-cache libc6-compat \
&& npm install -g pnpm@10.8.1 \
&& pnpm install --frozen-lockfile \
&& chown -R node:node /app
USER node
# build
FROM node:22.16.0-alpine AS build
WORKDIR /app
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules
RUN npm install -g pnpm@10.8.1 \
&& pnpm run build
# final stage
FROM node:22.16.0-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package.json pnpm-lock.yaml ./
COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=build /app/build ./build
RUN chown -R node:node /app
USER node
CMD ["npm", "start"]