Split the monolithic build-image.sh into three scripts: build-image.sh now only builds locally, run-image.sh
release / build (push) Failing after 1m46s
release / build (push) Failing after 1m46s
runs dist.sh inside that local image via a bind mount, andcupload-image.sh pushes the already-built image. The Dockerfile also warms the Gradle dependency cache in a throwaway build stage, and pre-installs the pinned CMake version, so `run-image.sh` doesn't re-download the same Maven dependencies on every run. dist.sh now strips the -pre+meta suffix before writing package.json's version, since Pebble's build tooling parses it strictly as X.Y.Z integers and was rejecting suffixed versions.
This commit is contained in:
+36
-4
@@ -1,17 +1,18 @@
|
||||
# Build environment for schwert_und_magie_on_pebble release artifacts:
|
||||
# Android SDK/NDK (companion app) + Pebble SDK (watch app), matching the
|
||||
# versions pinned in app/build.gradle.kts and validated on the maintainer's
|
||||
# dev machine. Rebuild and push with ../build-image.sh whenever a version
|
||||
# below, or the companion app's ndkVersion/compileSdk, changes.
|
||||
# dev machine. Rebuild with ../build-image.sh whenever a version below, or
|
||||
# the companion app's ndkVersion/compileSdk, changes.
|
||||
#
|
||||
# Does NOT contain the release keystore or any secrets — those are injected
|
||||
# at job runtime from Gitea Actions secrets, never baked into this image.
|
||||
FROM eclipse-temurin:21-jdk-jammy
|
||||
FROM eclipse-temurin:21-jdk-jammy AS base
|
||||
|
||||
ARG ANDROID_CMDLINE_TOOLS_VERSION=11076708
|
||||
ARG ANDROID_PLATFORM=android-36
|
||||
ARG ANDROID_BUILD_TOOLS=36.1.0
|
||||
ARG ANDROID_NDK=30.0.14904198
|
||||
ARG ANDROID_CMAKE=3.22.1
|
||||
ARG PEBBLE_TOOL_VERSION=5.0.35
|
||||
ARG PEBBLE_SDK_CORE_VERSION=4.9.169
|
||||
ARG NODE_VERSION=24.16.0
|
||||
@@ -35,7 +36,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
dos2unix autoconf automake pkg-config xa65 build-essential gettext flex \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# --- Android SDK: cmdline-tools, platform, build-tools, NDK ---
|
||||
# --- Android SDK: cmdline-tools, platform, build-tools, NDK, CMake ---
|
||||
# CMake version must match app/build.gradle.kts's externalNativeBuild.cmake.version
|
||||
# — baking it in here avoids AGP installing it on first `docker run` instead.
|
||||
RUN mkdir -p "$ANDROID_HOME/cmdline-tools" \
|
||||
&& curl -sSL -o /tmp/cmdline-tools.zip \
|
||||
"https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMDLINE_TOOLS_VERSION}_latest.zip" \
|
||||
@@ -48,6 +51,7 @@ RUN mkdir -p "$ANDROID_HOME/cmdline-tools" \
|
||||
"platforms;${ANDROID_PLATFORM}" \
|
||||
"build-tools;${ANDROID_BUILD_TOOLS}" \
|
||||
"ndk;${ANDROID_NDK}" \
|
||||
"cmake;${ANDROID_CMAKE}" \
|
||||
>/dev/null
|
||||
|
||||
# Node.js: `pebble sdk install` below runs `npm install` for the SDK-core's
|
||||
@@ -64,4 +68,32 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
||||
&& /root/.local/bin/uv tool install "pebble-tool==${PEBBLE_TOOL_VERSION}" \
|
||||
&& /root/.local/bin/pebble sdk install "${PEBBLE_SDK_CORE_VERSION}"
|
||||
|
||||
# --- Warm the Gradle dependency cache ---
|
||||
# The companion app's real Gradle project files (not the generated build/
|
||||
# output, and not the VICE/nibtools source tarballs — see .dockerignore) are
|
||||
# COPYed into a throwaway location and built once here, so every actual
|
||||
# `docker run` of this image (which bind-mounts a fresh checkout over
|
||||
# /workspace) hits a warm ~/.gradle cache instead of re-downloading the same
|
||||
# Maven dependencies from dl.google.com/mavenCentral every single run.
|
||||
#
|
||||
# buildVice/buildNibtools are excluded (their source tarballs aren't in the
|
||||
# build context) — CMake already handles that gracefully, falling back to a
|
||||
# placeholder (see vice_jni.c / build_vice.sh's own header comment) — so this
|
||||
# stage only ever warms the Gradle/Maven dependency cache, never bakes in
|
||||
# compiled VICE/nibtools output.
|
||||
#
|
||||
# This is a pure optimization: if the app's dependencies change after this
|
||||
# image was built, Gradle just downloads the delta against the warm cache at
|
||||
# `docker run` time — same as it would without this stage, just slower for
|
||||
# that one run, never broken. `|| true` means a transient network failure
|
||||
# here only costs a slower first `docker run`, never breaks the image build.
|
||||
FROM base AS gradle-cache-warm
|
||||
COPY SchwertUndMagieOnPebbleCompanionApp /tmp/warm/SchwertUndMagieOnPebbleCompanionApp
|
||||
WORKDIR /tmp/warm/SchwertUndMagieOnPebbleCompanionApp
|
||||
RUN chmod +x gradlew \
|
||||
&& (./gradlew bundleRelease assembleRelease -x buildVice -x buildNibtools --continue || true)
|
||||
|
||||
FROM base
|
||||
COPY --from=gradle-cache-warm /root/.gradle /root/.gradle
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
Reference in New Issue
Block a user