- Add Docker BuildKit builder setup for AMD64 and ARM64 platforms - Update backend and frontend Dockerfiles with platform flags - Create comprehensive build scripts for multi-arch workflows - Add verification script to test multi-architecture images - Update Makefile with multi-arch Docker targets - Add detailed documentation for multi-architecture setup This enables building Docker images that work on both development machines (AMD64) and Raspberry Pi cluster (ARM64) with automatic platform selection. 🤖 Generated with [AI Assistant] Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
39 lines
860 B
Docker
39 lines
860 B
Docker
# 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 --frozen-lockfile --production
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# --- Production stage ---
|
|
FROM --platform=$TARGETPLATFORM oven/bun:1-alpine
|
|
|
|
# Install curl for health checks and other utilities
|
|
RUN apk add --no-cache curl wget
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy dependencies from builder
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app .
|
|
|
|
# Create uploads directory
|
|
RUN mkdir -p uploads
|
|
|
|
# Expose port
|
|
EXPOSE 5000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \
|
|
CMD bun -e "fetch('http://localhost:5000/api/health').then(r=>process.exit(r.ok?0:1))"
|
|
|
|
# Start server
|
|
CMD ["bun", "server.js"]
|