-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 832 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 832 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
37
38
# ---------- Build stage ----------
FROM node:22-slim AS build
WORKDIR /app
# Install dependencies (lockfile enforced)
COPY package.json package-lock.json ./
RUN npm ci
# Copy only source needed to build
COPY . .
# Build application
RUN npm run build
# ---------- Runtime stage ----------
FROM node:22-slim
WORKDIR /app
# Copy package metadata + lockfile
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/package-lock.json ./package-lock.json
# Copy resolved dependencies exactly as built
COPY --from=build /app/node_modules ./node_modules
# Copy built output
COPY --from=build /app/dist ./dist
# Remove dev dependencies without re-resolving versions
RUN npm prune --omit=dev
# Runtime config
ENV NODE_ENV=production
ENV DOCKER_SOCKET=/var/run/docker.sock
EXPOSE 3000
CMD ["node", "dist/index.js"]