-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (34 loc) Β· 1.45 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (34 loc) Β· 1.45 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
# ββ Stage 1: Build βββββββββββββββββββββββββββββββββββββββββββ
FROM node:22-bookworm-slim AS builder
WORKDIR /app
# Install root dependencies (including devDependencies for build tooling)
COPY package*.json ./
RUN npm ci
# Copy dashboard manifest and install its dependencies separately
# This ensures dashboard/node_modules exists before the source arrives
COPY dashboard/package*.json dashboard/
RUN cd dashboard && npm ci
# Copy all source
COPY . .
# Build: tsc + openapi + dashboard + copy-dashboard
RUN npm run build
# Verify dashboard was built and copied correctly
RUN test -f dist/dashboard/index.html || \
(echo "ERROR: dist/dashboard/index.html not found after build" && exit 1)
# ββ Stage 2: Production βββββββββββββββββββββββββββββββββββββ
FROM node:22-bookworm-slim AS production
WORKDIR /app
# Install only production dependencies for runtime
COPY package*.json ./
COPY scripts/ scripts/
RUN npm ci --omit=dev
# Create non-root user
RUN groupadd --gid 1001 aegis && \
useradd --uid 1001 --gid aegis --shell /bin/bash --create-home aegis
# Copy built artifacts from builder
COPY --from=builder --chown=aegis:aegis /app/dist ./dist
COPY --from=builder --chown=aegis:aegis /app/openapi.yaml ./
USER aegis
ENV NODE_ENV=production
EXPOSE 9100
ENTRYPOINT ["node", "dist/server.js"]