Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Root .dockerignore — used when building Docker images with the repo
# root as build context (e.g., api/Dockerfile needs workspace packages).
node_modules
dist
coverage
.git
.env
.env.*
!.env.example
npm-debug.log*
.next
*.log
6 changes: 4 additions & 2 deletions .github/workflows/docker-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ jobs:
fail-fast: false
matrix:
include:
- context: api
- context: .
dockerfile: api/Dockerfile
image: xstreamroll-api
- context: app
- context: .
dockerfile: app/Dockerfile
image: xstreamroll-app
- context: xstreamroll-processing
image: xstreamroll-processing
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ jobs:
strategy:
matrix:
include:
- context: api
- context: .
dockerfile: api/Dockerfile
image: xstreamroll-api
- context: app
- context: .
dockerfile: app/Dockerfile
image: xstreamroll-app
- context: xstreamroll-processing
image: xstreamroll-processing
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ jobs:
matrix:
include:
- image: api
context: api
context: .
dockerfile: api/Dockerfile
- image: app
context: app
context: .
dockerfile: app/Dockerfile
- image: processing
context: xstreamroll-processing

Expand Down
31 changes: 23 additions & 8 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
# Build context: repo root (not api/) — required so pnpm can resolve file:
# workspace dependencies (@xstreamroll/types, @xstreamroll/contract-tests).
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./

# ── Workspace package manifests (needed for pnpm file: resolution) ────────────
COPY package.json ./
COPY packages/types/package.json packages/types/tsconfig.json ./packages/types/
COPY packages/types/src/ ./packages/types/src/
COPY tests/contracts/package.json tests/contracts/tsconfig.json ./tests/contracts/
# Issue #340: include SQL migration files so the k8s init container can run
# `node-pg-migrate up -d /app/database/migrations -m sql` without a separate
# ConfigMap mount. Keeps the runner, schema, and runtime image in lockstep
# from a single published artifact.
COPY database/migrations/ ./database/migrations/

# ── API package manifests and install ─────────────────────────────────────────
COPY api/package.json api/pnpm-lock.yaml api/pnpm-workspace.yaml ./api/
WORKDIR /app/api
RUN npm install -g pnpm && pnpm install --frozen-lockfile
COPY . .

# ── Copy remaining API source and build ───────────────────────────────────────
COPY api/ ./
RUN pnpm run build

# ── Production image ──────────────────────────────────────────────────────────
FROM node:20-alpine
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
# Issue #340: include SQL migration files so the k8s init container can run
# `node-pg-migrate up -d /app/database/migrations -m sql` without a separate
# ConfigMap mount. Keeps the runner, schema, and runtime image in lockstep
# from a single published artifact.
COPY --from=builder --chown=appuser:appgroup /app/api/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/api/node_modules ./node_modules
COPY --from=builder --chown=appuser:appgroup /app/database/migrations ./database/migrations
USER appuser
EXPOSE 3001
Expand Down
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"prom-client": "^15.1.3",
"cookie-parser": "^1.4.6",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.2",
"sanitize-html": "^2.17.4",
"socket.io": "^4.8.3",
"swagger-ui-express": "^5.0.1",
Expand Down
Loading
Loading