chore: adapt Dockerfile/compose for standalone server repo
- Dockerfile no longer bakes in a Flutter web build (this repo has no client/ dir); the web bundle is mounted at runtime instead. - docker-compose.yml: web bundle mount path configurable via WEB_CLIENT_BUILD_PATH, defaults to a sibling KC-APP checkout. - README: point to the KC-APP client repo for clients. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+7
-9
@@ -1,9 +1,8 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
#
|
#
|
||||||
# The Flutter web bundle is built on the HOST (it needs a ~2.8 GB SDK image
|
# Server-only image (this repo has no Flutter client). The web client is
|
||||||
# otherwise). Before `docker compose build`, run:
|
# built in the KC-APP client repo and its `build/web` output is mounted
|
||||||
# (cd client/app && flutter build web --release)
|
# into the container at runtime via WEB_CLIENT_DIR (see docker-compose.yml).
|
||||||
# This Dockerfile just copies client/app/build/web into the runtime image.
|
|
||||||
|
|
||||||
# --- 1. Backend build ---------------------------------------------------------
|
# --- 1. Backend build ---------------------------------------------------------
|
||||||
FROM node:20-bookworm-slim AS api-build
|
FROM node:20-bookworm-slim AS api-build
|
||||||
@@ -13,9 +12,9 @@ WORKDIR /src
|
|||||||
# openssl-1.1.x, which then fails to load in the runtime stage (openssl 3.0.x).
|
# openssl-1.1.x, which then fails to load in the runtime stage (openssl 3.0.x).
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends openssl \
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
COPY backend/package.json backend/package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY backend/ ./
|
COPY . .
|
||||||
RUN npx prisma generate && npm run build
|
RUN npx prisma generate && npm run build
|
||||||
|
|
||||||
# --- 2. Runtime -------------------------------------------------------------
|
# --- 2. Runtime -------------------------------------------------------------
|
||||||
@@ -28,9 +27,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends openssl \
|
|||||||
COPY --from=api-build /src/node_modules ./node_modules
|
COPY --from=api-build /src/node_modules ./node_modules
|
||||||
COPY --from=api-build /src/dist ./dist
|
COPY --from=api-build /src/dist ./dist
|
||||||
COPY --from=api-build /src/prisma ./prisma
|
COPY --from=api-build /src/prisma ./prisma
|
||||||
# Pre-built Flutter web bundle from the host; app.module reads WEB_CLIENT_DIR.
|
# Web client bundle is bind-mounted at runtime, not baked into the image;
|
||||||
COPY client/app/build/web ./web
|
# app.module reads WEB_CLIENT_DIR. See docker-compose.yml.
|
||||||
ENV WEB_CLIENT_DIR=/app/web
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
# Apply pending migrations, then boot.
|
# Apply pending migrations, then boot.
|
||||||
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/main.js"]
|
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/main.js"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# KC-App Backend
|
# KC-App Backend
|
||||||
|
|
||||||
NestJS API for the KC-App platform (see repo root README + plan for
|
NestJS API for the KC-App platform. Split out of the main KC-APP monorepo
|
||||||
architecture context).
|
(https://git.konfi-castle.com/linus/KC-APP); the Flutter clients live there.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -22,21 +22,27 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
# All non-DB config comes from backend/.env (needs Docker Compose v2,
|
# All non-DB config comes from .env (needs Docker Compose v2, which
|
||||||
# which strips surrounding quotes). DATABASE_URL and the FCM credential
|
# strips surrounding quotes). DATABASE_URL and the FCM credential path
|
||||||
# path are overridden below for the container.
|
# are overridden below for the container.
|
||||||
env_file:
|
env_file:
|
||||||
- backend/.env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgresql://postgres:postgres@db:5432/kcapp?schema=public
|
DATABASE_URL: postgresql://postgres:***@db:5432/kcapp?schema=public
|
||||||
PORT: "3000"
|
PORT: "3000"
|
||||||
GOOGLE_APPLICATION_CREDENTIALS: /app/serviceAccount.json
|
GOOGLE_APPLICATION_CREDENTIALS: /app/serviceAccount.json
|
||||||
APP_BASE_URL: http://localhost:3010
|
APP_BASE_URL: http://localhost:3010
|
||||||
|
WEB_CLIENT_DIR: /app/web
|
||||||
ports:
|
ports:
|
||||||
- "3010:3000"
|
- "3010:3000"
|
||||||
volumes:
|
volumes:
|
||||||
# Firebase service account — kept out of the image, mounted read-only.
|
# Firebase service account — kept out of the image, mounted read-only.
|
||||||
- ./backend/serviceAccount.json:/app/serviceAccount.json:ro
|
- ./serviceAccount.json:/app/serviceAccount.json:ro
|
||||||
|
# Pre-built Flutter web bundle, built separately in the KC-APP client
|
||||||
|
# repo (flutter build web --release) and mounted read-only here.
|
||||||
|
# Set WEB_CLIENT_BUILD_PATH (e.g. in .env) to that build/web directory;
|
||||||
|
# defaults to a sibling ../KC-APP checkout.
|
||||||
|
- ${WEB_CLIENT_BUILD_PATH:-../KC-APP/client/app/build/web}:/app/web:ro
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
Reference in New Issue
Block a user