# Multi-stage build for multi-architecture support (AMD64, ARM64) FROM --platform=$BUILDPLATFORM oven/bun:1-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN bun install # Copy source code COPY . . # Build production bundle RUN bun run build # --- Production stage with nginx --- FROM --platform=$TARGETPLATFORM nginx:alpine # Install wget for health checks RUN apk add --no-cache wget # Copy built assets COPY --from=builder /app/build /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s \ CMD wget --quiet --tries=1 --spider http://localhost:80/health || exit 1 CMD ["nginx", "-g", "daemon off;"]