mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-12 01:36:20 +02:00
56 lines
1.5 KiB
Docker
56 lines
1.5 KiB
Docker
# ============================================
|
|
# Stage 1: Build Flutter Web Application
|
|
# ============================================
|
|
FROM ghcr.io/cirruslabs/flutter:stable AS builder
|
|
|
|
USER root
|
|
|
|
WORKDIR /app
|
|
|
|
# Safe directory configuration for git
|
|
RUN git config --global --add safe.directory /app
|
|
|
|
# Enable web support (idempotent)
|
|
RUN flutter config --enable-web
|
|
|
|
# Copy dependency files first for better caching
|
|
# Note: pubspec.lock will be generated by flutter pub get if missing
|
|
COPY pubspec.yaml ./
|
|
|
|
# Get dependencies (generates pubspec.lock automatically)
|
|
RUN flutter pub get
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Re-run pub get after copying source to ensure lockfile consistency
|
|
RUN flutter pub get
|
|
|
|
# Build web application (CanvasKit renderer is now default)
|
|
RUN flutter build web --release --base-href="/" --verbose
|
|
|
|
# ============================================
|
|
# Stage 2: Serve with custom Dart server (with API proxy)
|
|
# ============================================
|
|
FROM dart:stable
|
|
|
|
WORKDIR /app
|
|
|
|
# Install SQLite3 library for FFI
|
|
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy entire bin directory (API, database, etc.)
|
|
COPY bin/ ./bin/
|
|
|
|
# Get dependencies
|
|
RUN dart pub get --directory=bin
|
|
|
|
# Copy built web application from builder stage
|
|
COPY --from=builder /app/build/web /app/web
|
|
|
|
# Expose port (internal only, not mapped to host)
|
|
EXPOSE 8089
|
|
|
|
# Serve web application with API proxy
|
|
CMD ["dart", "run", "bin/server.dart", "--port", "8089", "--path", "/app/web"]
|