CICD: Improve the Android Docker Image Build.

Introduce proper reuse of intermediary stages in the multi-stage build.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-01-20 01:05:14 +13:00 committed by Dirk Hohndel
parent bef21ff5eb
commit 6dd5922d15
2 changed files with 10 additions and 21 deletions

View file

@ -3,8 +3,8 @@ name: Android Docker Image CI
on:
push:
paths:
- scripts/docker/android-build-container
- .github/workflows/android-docker*
- scripts/docker/android-build-container/**
- .github/workflows/android-dockerimage.yml
jobs:
android-build-container:

View file

@ -1,6 +1,4 @@
FROM subsurface/android-build-container:5.15.1 as base
FROM ubuntu:22.04 as build
FROM ubuntu:22.04 as base
RUN apt-get update && \
apt-get upgrade -y && \
@ -11,12 +9,16 @@ RUN apt-get update && \
autoconf \
libtool-bin \
openjdk-8-jdk \
wget
wget && \
apt-get clean
FROM base as build
WORKDIR /android
# Scrape the manually curated Qt install from the previous build image
COPY --from=base /android/5.15.1 5.15.1
COPY --from=subsurface/android-build-container:5.15.1 /android/5.15.1 5.15.1
# install, NDK and SDK there, plus the three files from the Subsurface
# sources that we need to get the prep routines to run
@ -64,19 +66,8 @@ RUN rm -rf \
android-build-setup.sh \
/usr/lib/gcc
FROM ubuntu:22.04
# Repeat exactly the same step as in the 'build' image above, so it can be reused
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
unzip \
git \
cmake \
autoconf \
libtool-bin \
openjdk-8-jdk \
wget
FROM base as final
RUN apt-get install -y \
autoconf \
@ -107,5 +98,3 @@ COPY --from=build /android/ .
RUN git config --global --add safe.directory /android/subsurface && \
git config --global --add safe.directory /android/subsurface/libdivecomputer && \
git config --global --add safe.directory /android/subsurface/nightly-builds
RUN touch finished-"`date`"