-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (26 loc) · 691 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (26 loc) · 691 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
# syntax=docker/dockerfile:1
# Build Stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy deps
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci
# Copy source
COPY . .
# Build API
RUN npx nx build api
# Production Stage
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
# Copy built assets and package files from the build output
# Nx generates a package.json (and optional lockfile) in dist/api
COPY --from=builder /app/dist/api ./
# Install only production dependencies for the specific app
RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev
# Expose port
EXPOSE 3000
# Start
CMD ["node", "main.js"]