cc7043148a
Add complete CI/CD pipeline: - Gitea Actions workflow (build + deploy) - Multi-stage Dockerfile (Node build + nginx serve) - nginx config with SPA routing and cache headers - docker-compose.yml for local testing - .dockerignore to optimize build Pipeline flow: 1. Build job: npm ci + npm build + upload artifact 2. Deploy job (main only): Docker build + push to registry + Portainer webhook Requires Gitea secrets: - DOCKER_USERNAME - DOCKER_PASSWORD - PORTAINER_WEBHOOK_URL
37 lines
716 B
Docker
37 lines
716 B
Docker
# Multi-stage build for Astro static site
|
|
|
|
# Stage 1: Build
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production
|
|
|
|
# Copy source
|
|
COPY . .
|
|
|
|
# Build static site
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production - nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy built site to nginx html directory
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx config (if needed for SPA routing)
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|