mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-15 11:18:05 +02:00
chore: Optimize Docker build by expanding ignored files and improving Flutter web build caching.
This commit is contained in:
1 parent
f9098e02ed
commit
df33c02d1d
2 files changed
+37
-35
No files matched your search
+18
-15
@@ -1,21 +1,24 @@
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Flutter/Dart
|
||||
.dart_tool/
|
||||
.dart_tool
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
.pub-cache
|
||||
build/
|
||||
|
||||
# IDEs
|
||||
.idea/
|
||||
.vscode/
|
||||
*.iml
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
bin/.dart_tool
|
||||
bin/.packages
|
||||
bin/pubspec.lock
|
||||
ios/
|
||||
android/
|
||||
windows/
|
||||
linux/
|
||||
macos/
|
||||
*.log
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
entrypoint.sh
|
||||
README.md
|
||||
task.md
|
||||
implementation_plan.md
|
||||
walkthrough.md
|
||||
+19
-20
@@ -1,43 +1,42 @@
|
||||
# ============================================
|
||||
# Stage 1: Build Flutter Web Application
|
||||
# ============================================
|
||||
FROM ghcr.io/cirruslabs/flutter:stable AS web-builder
|
||||
|
||||
# Run as root for setup
|
||||
USER root
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Safe directory configuration for git
|
||||
RUN git config --global --add safe.directory /app
|
||||
# Disable analytics and precache early to cache this layer
|
||||
ENV FLUTTER_NO_ANALYTICS=1
|
||||
RUN flutter config --no-analytics && \
|
||||
flutter config --enable-web && \
|
||||
flutter precache --web
|
||||
|
||||
# Optimize DART VM Memory for build to prevent OOM
|
||||
# Increased to 16GB for high-performance servers
|
||||
# Optimize DART VM Memory for build
|
||||
ENV DART_VM_OPTIONS="--old_gen_heap_size=16384"
|
||||
|
||||
# Enable web support and PRECACHE artifacts to avoid downloads during build
|
||||
RUN flutter config --enable-web && flutter precache --web
|
||||
|
||||
# Clean build environment at the START if needed, but usually redundant in fresh image
|
||||
# RUN flutter clean
|
||||
|
||||
# Force cache invalidation when source changes (update this value to force rebuild)
|
||||
ARG CACHEBUST=2026-03-09-mobile-v1
|
||||
# Safe directory configuration for git (needed even if we ignore .git for some flutter tools)
|
||||
RUN git config --global --add safe.directory /app
|
||||
|
||||
# Copy dependency files first for better caching
|
||||
COPY pubspec.yaml ./
|
||||
|
||||
# Get dependencies
|
||||
RUN flutter pub get
|
||||
|
||||
# Copy source code
|
||||
# Copy source code (respecting .dockerignore)
|
||||
COPY . .
|
||||
|
||||
# Generate code
|
||||
RUN dart run build_runner build --delete-conflicting-outputs
|
||||
|
||||
# Build web application
|
||||
# We use --no-pub because we already ran it
|
||||
RUN flutter build web --release --base-href="/" --no-pub --no-wasm-dry-run --no-tree-shake-icons --verbose
|
||||
# --no-pub ensures we use what we got in the previous layer
|
||||
# --web-renderer canvaskit for higher quality (since we have 64GB RAM)
|
||||
RUN flutter build web --release \
|
||||
--base-href="/" \
|
||||
--no-pub \
|
||||
--no-wasm-dry-run \
|
||||
--no-tree-shake-icons \
|
||||
--web-renderer canvaskit \
|
||||
--verbose
|
||||
|
||||
# ============================================
|
||||
# Stage 2: Compile Configurable Server (Native)
|
||||
|
||||
Reference in new issue
Block a user