-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (34 loc) · 965 Bytes
/
Dockerfile
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
44
45
46
# syntax=docker/dockerfile:1.7-labs
FROM node:22-bookworm AS base
WORKDIR /app
USER root
RUN apt-get update && \
apt-get install -y dumb-init
COPY package.json package-lock.json /app/
RUN npm install --audit=false --fund=false --omit dev
#
# build the app
#
FROM base AS builder
COPY . /app/
RUN npm install --audit=false --fund=false
RUN npm run build
#
# runner
#
FROM gcr.io/distroless/nodejs22-debian12:latest AS runner
ARG COMMIT="(not set)"
ARG LASTMOD="(not set)"
ENV COMMIT=$COMMIT
ENV LASTMOD=$LASTMOD
ENV NODE_ENV=production
USER nonroot
COPY --chown=nonroot:nonroot --from=base /usr/bin/dumb-init /usr/bin/dumb-init
COPY --chown=nonroot:nonroot --from=base /app/node_modules /app/node_modules
COPY --chown=nonroot:nonroot --from=builder /app/dist /app/dist
COPY --chown=nonroot:nonroot --exclude=src . /app
WORKDIR /app
ENV PORT 5000
ENV HOSTNAME 0.0.0.0
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/nodejs/bin/node", "dist/server.js"]