carservice: initial commit

This commit is contained in:
Hermes
2026-07-20 21:17:12 +01:00
commit d315323191
69 changed files with 9255 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
# syntax=docker/dockerfile:1
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy dependency files
COPY package.json package-lock.json* ./
COPY prisma ./prisma
# Install dependencies (including dev deps for build)
RUN npm ci
# Copy source code
COPY . .
# Build Next.js app (standalone output)
RUN npx prisma generate
RUN npm run build
# --- Production stage ---
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
# Copy standalone output from builder
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
# Generate Prisma client for production runtime
RUN npm install prisma --save-dev && npx prisma generate
# Ensure DB directory exists and is writable
RUN mkdir -p /app/prisma && chown -R nextjs:nodejs /app/prisma
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]