-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (25 loc) · 1020 Bytes
/
Copy pathDockerfile
File metadata and controls
38 lines (25 loc) · 1020 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
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /build
# Copy all package manifests before install (workspace-aware layer caching)
COPY package.json package-lock.json ./
COPY packages/api-grade-core/package.json ./packages/api-grade-core/
RUN npm ci --ignore-scripts
COPY tsconfig.json ./
COPY src/ ./src/
COPY packages/api-grade-core/ ./packages/api-grade-core/
RUN npm run build
# Stage 2: Runtime
FROM node:20-alpine AS runtime
WORKDIR /app
# Copy manifests so npm knows about the workspace and installs its deps
COPY package.json package-lock.json ./
COPY packages/api-grade-core/package.json ./packages/api-grade-core/
RUN npm ci --omit=dev --ignore-scripts
# Copy compiled CLI output from builder
COPY --from=builder /build/dist ./dist
# Copy compiled library output from builder (satisfies the workspace symlink)
COPY --from=builder /build/packages/api-grade-core/dist ./packages/api-grade-core/dist
# Run as non-root user for security
USER node
ENTRYPOINT ["node", "/app/dist/cli/index.js"]