All checks were successful
Release: multi-arch Docker images / build-push (push) Successful in 26m49s
- Dockerfile: bun install -> npm ci (bun tar-extract unstable under qemu arm64) - pin @hookform/resolvers 5.2.2 (5.7.x forces ajv@8 -> broken npm lockfile) - package-lock.json regenerated with linux-arm64 native optionals (lightningcss, sharp, tailwindcss-oxide, parcel/watcher) - runtime CMD stays node server.js (bun not installed in runner image)
62 lines
1.5 KiB
Docker
62 lines
1.5 KiB
Docker
# --- Stage 1: Build ---
|
|
FROM node:22-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies (npm ci — стабилен под qemu-эмуляцией arm64 в multi-arch сборке)
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Copy source
|
|
COPY prisma ./prisma/
|
|
COPY tsconfig.json next.config.ts postcss.config.mjs tailwind.config.ts components.json ./
|
|
COPY public ./public/
|
|
COPY src ./src/
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Build Next.js (output: standalone)
|
|
RUN npx next build
|
|
|
|
# Copy static assets into standalone
|
|
RUN cp -r .next/static .next/standalone/.next/ && \
|
|
cp -r public .next/standalone/
|
|
|
|
# --- Stage 2: Production ---
|
|
FROM node:22-slim AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
# OpenSSL для Prisma (SQLite) + curl для healthcheck
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
openssl \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
# Copy standalone output
|
|
COPY --from=builder /app/.next/standalone ./
|
|
|
|
# Copy static files
|
|
COPY --from=builder /app/.next/standalone/.next ./.next
|
|
|
|
# Copy Prisma schema for potential migrations
|
|
COPY --from=builder /app/prisma ./prisma/
|
|
|
|
# Create db and uploads directories
|
|
RUN mkdir -p /app/db /app/uploads && chown nextjs:nodejs /app/db /app/uploads
|
|
|
|
# Switch to non-root
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"] |