-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
35 lines (24 loc) · 1.18 KB
/
Dockerfile.api
File metadata and controls
35 lines (24 loc) · 1.18 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
# ── Stage 1: install dependencies ─────────────────────────────────────────────
FROM node:20-slim AS builder
WORKDIR /app
# Copy all package manifests first (root + workspaces) for layer-cache efficiency
COPY package*.json ./
COPY apps/api/package*.json ./apps/api/
# Install all workspace dependencies
RUN npm install --prefer-offline --no-audit --no-fund
# Copy the rest of the source
COPY . .
# ── Stage 2: runtime ───────────────────────────────────────────────────────────
FROM node:20-slim
# Install curl for the healthcheck
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy everything from builder (node_modules included)
COPY --from=builder /app /app
# Drop to non-root for security
RUN groupadd -r satelink && useradd -r -g satelink satelink \
&& chown -R satelink:satelink /app
USER satelink
EXPOSE 8080
# NODE_ENV is injected by docker-compose; not baked in here
CMD ["node", "apps/api/server.js"]