diff --git a/Dockerfile b/Dockerfile index ae28c7462..21362ee66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,16 +25,9 @@ ENV ANDROID_SDK_ROOT=/opt/android-sdk ENV ANDROID_SDK_URL=https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_TOOLS_VERSION}_latest.zip ENV PATH=${ANDROID_HOME}/cmdline-tools/bin:${ANDROID_HOME}/platform-tools:${PATH} -# Runtime deps for build-tools/aapt2. -RUN DPKG_ARCH=$(dpkg --print-architecture) && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - libc6:${DPKG_ARCH} \ - libstdc++6:${DPKG_ARCH} \ - zlib1g:${DPKG_ARCH} \ - libtinfo6:${DPKG_ARCH} \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* +# Runtime deps for build-tools on arm64, amd64 libs are needed for x86_64-only binary (aapt2 etc) under emulation. +COPY scripts/setup-multiarch-apt.sh /usr/local/bin/setup-multiarch-apt +RUN /usr/local/bin/setup-multiarch-apt # Install just from a pinned release. RUN case ${TARGETARCH} in \ diff --git a/core b/core index 15329f3f0..4a0332e12 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 15329f3f0e5fb038f41d8040588c4edf890c5992 +Subproject commit 4a0332e12a81f6fb852ec845799de0fb8df1e2be diff --git a/justfile b/justfile index 98d3af298..faef0332c 100644 --- a/justfile +++ b/justfile @@ -48,6 +48,8 @@ build-base-image: TAG := env("TAG", "main") BUILD_MODE := env("BUILD_MODE", "") BUNDLE_TASK := env("BUNDLE_TASK", "clean :app:bundleGoogleRelease assembleUniversalRelease") +DOCKER_PLATFORM := env("DOCKER_PLATFORM", "linux/amd64") +OUTPUTS_DIR := env("OUTPUTS_DIR", "") GRADLE_WORKERS_MAX := env("GRADLE_WORKERS_MAX", "4") build-app-image: @@ -58,9 +60,9 @@ build-app-image: tag="{{TAG}}" if ! docker pull ghcr.io/gemwalletcom/gem-android-base:${base_tag} >/dev/null 2>&1; then echo "Base image ghcr.io/gemwalletcom/gem-android-base:${base_tag} not found; building locally..." >&2 - DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build --platform linux/amd64 -t ghcr.io/gemwalletcom/gem-android-base:${base_tag} . + DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="{{DOCKER_PLATFORM}}" docker build --platform "{{DOCKER_PLATFORM}}" -t ghcr.io/gemwalletcom/gem-android-base:${base_tag} . fi - DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build --platform linux/amd64 \ + DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="{{DOCKER_PLATFORM}}" docker build --platform "{{DOCKER_PLATFORM}}" \ --build-arg TAG="${tag}" \ --build-arg SKIP_SIGN=true \ --build-arg BUNDLE_TASK="${BUNDLE_TASK}" \ @@ -78,15 +80,20 @@ build-app-in-docker: container_name="gem-android-app-build" gradle_cache=$(mktemp -d) maven_cache=$(mktemp -d) + outputs_dir="{{OUTPUTS_DIR}}" trap 'rm -rf "${gradle_cache}" "${maven_cache}"; docker rm -f ${container_name} >/dev/null 2>&1 || true' EXIT docker rm -f ${container_name} >/dev/null 2>&1 || true - DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --platform linux/amd64 --name ${container_name} \ + DOCKER_DEFAULT_PLATFORM="{{DOCKER_PLATFORM}}" docker run --platform "{{DOCKER_PLATFORM}}" --name ${container_name} \ -e SKIP_SIGN=true \ -e BUNDLE_TASK="${BUNDLE_TASK}" \ -v "${gradle_cache}":/root/.gradle \ -v "${maven_cache}":/root/.m2 \ gem-android-app-verify \ bash -lc 'cd /root/gem-android && ./gradlew ${BUNDLE_TASK} --no-daemon --build-cache -Dorg.gradle.workers.max={{GRADLE_WORKERS_MAX}}' + if [ -n "${outputs_dir}" ]; then + mkdir -p "${outputs_dir}" + docker cp "${container_name}":/root/gem-android/app/build/outputs/. "${outputs_dir}/" + fi core-upgrade: @git submodule update --recursive --remote diff --git a/reproducible/base_image_tag.txt b/reproducible/base_image_tag.txt index 3726ed137..ad246b8a5 100644 --- a/reproducible/base_image_tag.txt +++ b/reproducible/base_image_tag.txt @@ -1 +1 @@ -base-2026-01-30 +base-2026-02-04 diff --git a/scripts/setup-multiarch-apt.sh b/scripts/setup-multiarch-apt.sh new file mode 100755 index 000000000..d4bb3995b --- /dev/null +++ b/scripts/setup-multiarch-apt.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -euo pipefail + +arch="$(dpkg --print-architecture)" +extra="" + +if [ "$arch" = "arm64" ]; then + dpkg --add-architecture amd64 + + if ! grep -q '^Architectures:' /etc/apt/sources.list.d/ubuntu.sources; then + sed -i '/^Types: deb$/a Architectures: arm64' /etc/apt/sources.list.d/ubuntu.sources + fi + + . /etc/os-release + codename="${VERSION_CODENAME:-${UBUNTU_CODENAME:-}}" + if [ -z "$codename" ]; then + echo "Missing Ubuntu codename in /etc/os-release" >&2 + exit 1 + fi + + cat > /etc/apt/sources.list.d/ubuntu-amd64.sources <