perf: pre-warm Gradle cache in Docker image

Run a dummy build during docker build to download all Gradle/Maven
dependencies. This cuts first user build from ~15 min to ~3-5 min.
Docker image is bigger but builds are dramatically faster.
This commit is contained in:
Zebratic committed 2026-03-15 17:14:55 +00:00
1 parent 80f9c9bcdc
commit 26fefd623a
1 file changed
+11
+11
View File
@@ -65,6 +65,17 @@ COPY build-worker/package.json /worker/package.json
COPY build-worker/template /worker/template
RUN cd /worker && npm install
# ── Pre-warm Gradle cache (saves ~10 min on first user build) ──
# Run a dummy build with the template to download all Gradle/Maven deps
RUN mkdir -p /tmp/warmup && cp -r /worker/template/* /tmp/warmup/ && \
cd /tmp/warmup && npm install --legacy-peer-deps && \
npx expo prebuild --platform android --no-install && \
cd /tmp/warmup/android && chmod +x gradlew && \
./gradlew assembleRelease --no-daemon \
-Dorg.gradle.jvmargs='-Xmx2g' || true && \
# Keep the Gradle cache, delete the project
rm -rf /tmp/warmup
# ── Supervisor config to run both processes ──
RUN mkdir -p /var/log/supervisor
COPY <<'EOF' /etc/supervisor/conf.d/app.conf