From 2d1139fd72317fbb3e38b6e59935ef17c7267e46 Mon Sep 17 00:00:00 2001 From: voidash Date: Sun, 27 Sep 2026 22:51:27 +0545 Subject: [PATCH] chore: make compose ports configurable The host ports for Postgres and the app were fixed at 5432 and 3000. They can now be overridden with DB_PORT and API_PORT; the defaults are unchanged. Also document that the migrate image runs one-off tasks such as db:init, and fix a Dockerfile comment that still mentioned the removed design CSS and fonts. Signed-off-by: voidash --- apps/api/Dockerfile | 4 ++-- compose.yaml | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 0300e21..2ec84d0 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -35,8 +35,8 @@ ENV STORAGE_DIR=/app/storage RUN mkdir -p /app/storage && chown node:node /app/storage -# Standalone output does not include public/ or static/; both are required for -# the UI (design CSS, fonts, emblem) and must be copied explicitly. +# Standalone output does not include public/ or .next/static; the UI needs both +# (client bundles, stylesheets, images), so they are copied explicitly. COPY --from=build --chown=node:node /repo/apps/api/.next/standalone/ ./ COPY --from=build --chown=node:node /repo/apps/api/.next/static ./apps/api/.next/static COPY --from=build --chown=node:node /repo/apps/api/public ./apps/api/public diff --git a/compose.yaml b/compose.yaml index 526eae9..0507427 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,8 +7,9 @@ services: POSTGRES_USER: refined POSTGRES_PASSWORD: refined POSTGRES_DB: refined + # Override the host ports with DB_PORT / API_PORT when they are taken. ports: - - "127.0.0.1:5432:5432" + - "127.0.0.1:${DB_PORT:-5432}:5432" volumes: - gov-portal-pgdata:/var/lib/postgresql/data healthcheck: @@ -28,7 +29,7 @@ services: DATABASE_URL: postgres://refined:refined@db:5432/refined STORAGE_DIR: /app/storage ports: - - "127.0.0.1:3000:3000" + - "127.0.0.1:${API_PORT:-3000}:3000" volumes: - gov-portal-avatars:/app/storage depends_on: @@ -36,7 +37,9 @@ services: condition: service_completed_successfully # Gate API startup on a successful schema migration. This is safe to rerun: - # Drizzle records applied migrations in the database. + # Drizzle records applied migrations in the database. The image also carries + # the repository scripts, so it runs one-off tasks too: + # docker compose run --rm migrate bun run db:init migrate: build: context: .