Brings full Postgres + api + web compose setup so the app can run on any machine with just Docker, instead of requiring a host PostgreSQL install. Includes a one-shot migrate service that pushes the Drizzle schema before the API starts. Web image serves the Vite build via nginx and proxies /api/* to the api-server. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
Docker
35 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM node:24-alpine AS base
|
|
RUN npm install -g pnpm@10
|
|
WORKDIR /repo
|
|
|
|
FROM base AS deps
|
|
COPY .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.base.json tsconfig.json ./
|
|
COPY artifacts/api-server/package.json artifacts/api-server/
|
|
COPY artifacts/cra-app/package.json artifacts/cra-app/
|
|
COPY artifacts/mockup-sandbox/package.json artifacts/mockup-sandbox/
|
|
COPY lib/api-client-react/package.json lib/api-client-react/
|
|
COPY lib/api-spec/package.json lib/api-spec/
|
|
COPY lib/api-zod/package.json lib/api-zod/
|
|
COPY lib/db/package.json lib/db/
|
|
COPY scripts/package.json scripts/
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
FROM deps AS build-api
|
|
COPY lib lib
|
|
COPY artifacts/api-server artifacts/api-server
|
|
RUN pnpm --filter @workspace/api-server run build
|
|
|
|
FROM node:24-alpine AS runtime-api
|
|
WORKDIR /app
|
|
COPY --from=build-api /repo/artifacts/api-server/dist ./dist
|
|
ENV NODE_ENV=production
|
|
EXPOSE 3000
|
|
CMD ["node", "--enable-source-maps", "dist/index.mjs"]
|
|
|
|
FROM deps AS migrate
|
|
COPY lib lib
|
|
WORKDIR /repo
|
|
CMD ["pnpm", "--filter", "@workspace/db", "run", "push-force"]
|