xworkmate-app/lib/web/Dockerfile
Haitao Pan 9000d78ed5 feat(web): add Dockerfile for Flutter web builds
Multi-stage build with Flutter SDK for building and Caddy for serving.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 23:55:22 +08:00

35 lines
654 B
Docker

# Stage 1: Build Flutter web
FROM ghcr.io/flutter/flutter:3.41.4 AS builder
WORKDIR /app
# Copy pubspec files for dependency caching
COPY pubspec.yaml pubspec.lock ./
RUN flutter pub get
# Copy source code
COPY lib/ ./lib/
COPY assets/ ./assets/
COPY config/ ./config/
COPY web/ ./web/
# Build Flutter web
RUN flutter build web --release
# Stage 2: Serve with Caddy
FROM caddy:2-alpine
WORKDIR /app
# Copy built web assets from builder
COPY --from=builder /app/build/web ./public
# Copy Caddyfile
COPY lib/web/Caddyfile ./Caddyfile
# Expose port
EXPOSE 8080
# Start Caddy
CMD ["caddy", "run", "--config", "Caddyfile", "--adapter", "caddyfile"]