This commit is contained in:
2026-09-19 22:19:35 +02:00
commit 231b3e006a
124 changed files with 13816 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
FROM node:20-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm
# Copy workspace config
COPY pnpm-workspace.yaml package.json tsconfig.base.json ./
# Copy package.json files for workspace resolution
COPY packages/shared/package.json packages/shared/
COPY apps/api/package.json apps/api/
COPY apps/dashboard/package.json apps/dashboard/
# Install dependencies (including devDependencies for building)
RUN pnpm install --frozen-lockfile
# Copy source code
COPY packages/shared packages/shared
COPY apps/api apps/api
COPY apps/dashboard apps/dashboard
# Build shared package first
RUN pnpm --filter @kooltab/shared run build
# Generate Prisma client
RUN cd apps/api && npx prisma generate
# Build API and Dashboard
RUN pnpm --filter @kooltab/api run build
RUN pnpm --filter @kooltab/dashboard run build
# ---- Production API image ----
FROM node:20-alpine AS api
WORKDIR /app
RUN npm install -g pnpm
# Copy built API output
COPY --from=builder /app/apps/api/dist ./dist
COPY --from=builder /app/apps/api/prisma ./prisma
COPY --from=builder /app/apps/api/package.json ./
# Install only production dependencies
RUN pnpm install --frozen-lockfile --prod
# Copy shared package (needed at runtime)
COPY --from=builder /app/packages/shared/dist ./node_modules/@kooltab/shared/dist
COPY --from=builder /app/packages/shared/package.json ./node_modules/@kooltab/shared/
EXPOSE 3001
# Run migrations on startup, then start server
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/main"]
# ---- Production Dashboard image ----
FROM node:20-alpine AS dashboard
WORKDIR /app
RUN npm install -g pnpm
COPY --from=builder /app/apps/dashboard/.next ./.next
COPY --from=builder /app/apps/dashboard/public ./public
COPY --from=builder /app/apps/dashboard/package.json ./
COPY --from=builder /app/apps/dashboard/next.config.js ./
# Install only production dependencies
RUN pnpm install --frozen-lockfile --prod
EXPOSE 3000
CMD ["node_modules/.bin/next", "start"]