Files
xtremobile/Dockerfile
T

66 lines
1.8 KiB
Docker

# ============================================
# Stage 1: Build Flutter Web Application
# ============================================
# Using a specific Flutter version to ensure consistent builds
FROM ghcr.io/cirruslabs/flutter:3.27.4 AS builder
USER root
WORKDIR /app
# Safe directory configuration for git
RUN git config --global --add safe.directory /app
# Diagnostic: Show Flutter version
RUN flutter --version
# 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
# Diagnostic: Analyze for errors before building
RUN flutter analyze --no-fatal-warnings || true
# Build web application (CanvasKit renderer is now default)
RUN flutter build web --release --base-href="/"
# ============================================
# Stage 2: Serve with custom Dart server (with API proxy)
# ============================================
FROM dart:stable
WORKDIR /app
# Install SQLite3 library for FFI and FFmpeg for IPTV stream transcoding
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev ffmpeg && rm -rf /var/lib/apt/lists/*
# Create directory for HLS stream output
RUN mkdir -p /tmp/streams && chmod 777 /tmp/streams
# 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"]