- Add Dockerfile for building Next.js images - Replace init-container deployment with standard deployment - Add kustomization with image tag tracking - Add deploy.sh script for CI/CD pipeline This enables proper GitOps auto-deployment: 1. Build image with commit hash tag 2. Push to GHCR 3. Update kustomization.yaml image tag 4. Flux detects change and restarts pods
31 lines
548 B
Docker
31 lines
548 B
Docker
# Multi-stage build for Next.js
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
RUN npm ci --prefer-offline --no-audit
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:20-slim AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
|
|
# Copy necessary files from builder
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"]
|