-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (39 loc) · 1.75 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (39 loc) · 1.75 KB
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
47
48
49
50
# syntax=docker/dockerfile:1.7
# ---------------------------------------------------------------------------
# Build stage — Alpine with npm/build tooling
# ---------------------------------------------------------------------------
FROM node:24-alpine AS builder
WORKDIR /app
# Install all dependencies (including dev) for build
COPY package*.json ./
RUN npm ci
# Build the project (outputs dist/http.js + dist/stdio.js)
COPY . .
RUN npm run build
# Reduce node_modules to production-only (we copy this into runtime)
RUN npm ci --omit=dev \
&& npm cache clean --force
# ---------------------------------------------------------------------------
# Runtime stage — Google distroless (no shell, no package manager, nonroot)
# Image: gcr.io/distroless/nodejs24-debian13:nonroot
# - Public, no auth required
# - Runs as user 65532 (nonroot)
# - ENTRYPOINT is already ["/nodejs/bin/node"], so CMD is just script args
# ---------------------------------------------------------------------------
FROM gcr.io/distroless/nodejs24-debian13:nonroot AS runner
ENV NODE_ENV=production
WORKDIR /app
# Copy production node_modules + built artifacts + package.json (for ESM type:module)
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
ENV PORT=3000
ENV VECHAIN_NETWORK=mainnet
EXPOSE 3000
# Run explicitly as the distroless `nonroot` user (UID/GID 65532). The base
# image already defaults to this user, but pinning it here keeps the
# Dockerfile non-root even if a future base bump changes the default.
USER 65532:65532
# Distroless has no shell — rely on platform health check (e.g. App Runner /ready)
# CMD is appended to the image's ENTRYPOINT (`/nodejs/bin/node`)
CMD ["dist/http.js"]