mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-24 15:38:04 +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
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.dart_tool
|
||||||
# Flutter/Dart
|
|
||||||
.dart_tool/
|
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
.packages
|
.packages
|
||||||
.pub-cache/
|
.pub-cache
|
||||||
.pub/
|
|
||||||
build/
|
build/
|
||||||
|
bin/.dart_tool
|
||||||
# IDEs
|
bin/.packages
|
||||||
.idea/
|
bin/pubspec.lock
|
||||||
.vscode/
|
ios/
|
||||||
*.iml
|
android/
|
||||||
|
windows/
|
||||||
# OS
|
linux/
|
||||||
.DS_Store
|
macos/
|
||||||
Thumbs.db
|
*.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
|
# Stage 1: Build Flutter Web Application
|
||||||
# ============================================
|
|
||||||
FROM ghcr.io/cirruslabs/flutter:stable AS web-builder
|
FROM ghcr.io/cirruslabs/flutter:stable AS web-builder
|
||||||
|
|
||||||
|
# Run as root for setup
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Safe directory configuration for git
|
# Disable analytics and precache early to cache this layer
|
||||||
RUN git config --global --add safe.directory /app
|
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
|
# Optimize DART VM Memory for build
|
||||||
# Increased to 16GB for high-performance servers
|
|
||||||
ENV DART_VM_OPTIONS="--old_gen_heap_size=16384"
|
ENV DART_VM_OPTIONS="--old_gen_heap_size=16384"
|
||||||
|
|
||||||
# Enable web support and PRECACHE artifacts to avoid downloads during build
|
# Safe directory configuration for git (needed even if we ignore .git for some flutter tools)
|
||||||
RUN flutter config --enable-web && flutter precache --web
|
RUN git config --global --add safe.directory /app
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Copy dependency files first for better caching
|
# Copy dependency files first for better caching
|
||||||
COPY pubspec.yaml ./
|
COPY pubspec.yaml ./
|
||||||
|
|
||||||
# Get dependencies
|
|
||||||
RUN flutter pub get
|
RUN flutter pub get
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code (respecting .dockerignore)
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Generate code
|
# Generate code
|
||||||
RUN dart run build_runner build --delete-conflicting-outputs
|
RUN dart run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
# Build web application
|
# Build web application
|
||||||
# We use --no-pub because we already ran it
|
# --no-pub ensures we use what we got in the previous layer
|
||||||
RUN flutter build web --release --base-href="/" --no-pub --no-wasm-dry-run --no-tree-shake-icons --verbose
|
# --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)
|
# Stage 2: Compile Configurable Server (Native)
|
||||||
|
|||||||
Reference in new issue
Block a user