carservice: initial commit
Build and publish images / docker (push) Canceled after 0s

This commit is contained in:
Hermes
2026-07-20 20:51:23 +01:00
commit f7a9906add
77 changed files with 9403 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
# 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
# Copy entrypoint and make it executable
COPY --from=builder --chown=nextjs:nodejs /app/deployment/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
USER nextjs
EXPOSE 3000
ENTRYPOINT ["/app/entrypoint.sh"]