Some checks failed
Build and Deploy / build (push) Has been cancelled
- Add GitHub Actions workflow to build and push Docker images to GHCR - Add Dockerfile for multi-stage builds - Update deployment to use GHCR images - Add GHCR authentication secrets - Configure Flux ImageRepository, ImagePolicy, and ImageUpdateAutomation - Remove init container approach in favor of proper Docker builds Auto-deploy flow: 1. Push to master triggers GitHub Actions 2. GitHub Actions builds image with commit hash tag 3. Image pushed to ghcr.io/unchainedio/manoon-headless 4. Flux ImageRepository detects new image 5. Flux ImageUpdateAutomation updates kustomization.yaml 6. Flux Kustomization applies new deployment 7. Kubernetes restarts pods with new image
31 lines
553 B
Docker
31 lines
553 B
Docker
# Multi-stage build for Next.js
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
RUN npm install --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"]
|