-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 798 Bytes
/
Dockerfile
File metadata and controls
36 lines (24 loc) · 798 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
FROM node:21.6-alpine3.19 AS installer
WORKDIR /usr/src/app
RUN apk upgrade --update-cache --available && \
apk add python3 make g++ && \
rm -rf /var/cache/apk/*
COPY . .
RUN npm ci
FROM node:21.6-alpine3.19 AS builder
WORKDIR /usr/src/app
COPY . .
COPY --from=installer /usr/src/app/node_modules ./node_modules
# remove all dev modules
RUN npm run build && rm -R ./node_modules && npm install --production
FROM node:21.6-alpine3.19
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
WORKDIR /usr/src/app
RUN apk upgrade --update-cache --available && \
apk add openssl curl && \
rm -rf /var/cache/apk/*
# generic keys
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/node_modules ./node_modules
CMD [ "node", "--no-experimental-fetch", "./dist/server.js" ]