Skip to content

Commit

Permalink
CICD: Improve the Android Docker Image Build.
Browse files Browse the repository at this point in the history
Introduce proper reuse of intermediary stages in the multi-stage build.

Signed-off-by: Michael Keller <[email protected]>
  • Loading branch information
mikeller committed Jan 19, 2024
1 parent 79d0a97 commit 574ef92
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions scripts/docker/android-build-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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
Expand Down Expand Up @@ -64,19 +66,7 @@ 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 \
Expand Down Expand Up @@ -107,5 +97,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`"

0 comments on commit 574ef92

Please sign in to comment.