chore: add Coolify deployment scaffolding (Dockerfiles, prod compose, git hygiene)
- apps/api/Dockerfile: build NestJS, run prisma migrate deploy on start - apps/web/Dockerfile + nginx.conf: build Vite, serve static, proxy /api -> api - docker-compose.coolify.yml: full prod stack (postgres, redis, minio, keycloak, api, web) - .dockerignore / .gitignore / .gitattributes Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Build context = monorepo root (hrm-medpark/)
|
||||
|
||||
FROM node:20-bookworm-slim AS base
|
||||
ENV PNPM_HOME="/pnpm" PATH="/pnpm:$PATH"
|
||||
RUN corepack enable && apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /repo
|
||||
|
||||
# ---- install + build ----
|
||||
FROM base AS build
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||||
COPY apps/api/package.json apps/api/package.json
|
||||
COPY apps/web/package.json apps/web/package.json
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY apps/api apps/api
|
||||
RUN pnpm --filter api exec prisma generate && pnpm --filter api build
|
||||
|
||||
# ---- runtime ----
|
||||
FROM base AS runtime
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /repo
|
||||
# pnpm keeps the package store at the repo-root node_modules/.pnpm; copy both trees so symlinks resolve
|
||||
COPY --from=build /repo/node_modules ./node_modules
|
||||
COPY --from=build /repo/apps/api ./apps/api
|
||||
WORKDIR /repo/apps/api
|
||||
EXPOSE 3001
|
||||
# apply pending migrations, then start; falls back to start if migrate has nothing to do
|
||||
CMD ["sh", "-c", "pnpm exec prisma migrate deploy && node dist/main"]
|
||||
Reference in New Issue
Block a user