-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (24 loc) · 746 Bytes
/
Copy pathDockerfile
File metadata and controls
30 lines (24 loc) · 746 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
# Builder
# ---
FROM node:22 AS build-environment
WORKDIR /opt/app
COPY package*.json ./
# install all packaged needed for build
RUN npm install --omit optional
# copy all files that are explicitly needed for build (see .dockerignore)
COPY . .
# build the app
RUN npm run build
# remove all packages and install only production dependencies
RUN rm -rf node_modules && npm i --production --ignore-scripts
# Runner
# ---
FROM gcr.io/distroless/nodejs22-debian12 AS production-environment
COPY --from=build-environment /opt/app /opt/app
WORKDIR /opt/app
ARG NODE_ENV=production
ENV NODE_ENV=$NODE_ENV
ENV PATH=/opt/node_app/node_modules/.bin:$PATH
#ENTRYPOINT ["node","dist/index.js"]
# distroless start command:
CMD ["dist/backend/index.js"]