CICD: Update the android Build Docker Image.

Update the android build docker image:
- rebase on ubuntu 22.04;
- add tooling required to sign APKs;
- changes to make the container re-usable;
- change to a multi-stage build to keep the image size smaller;
- generic improvements to the Dockerfile

Also update the example script for how to use the container.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-01-05 22:03:43 +13:00 committed by Dirk Hohndel
parent 62ca2d5b85
commit e8dd3389a7
4 changed files with 81 additions and 52 deletions

View file

@ -19,29 +19,24 @@ CONTAINER_ID=$(docker container ls -a -q -f name=${CONTAINER_NAME})
# Create the image if it does not exist
if [[ -z "${CONTAINER_ID}" ]]; then
docker create -v ${SUBSURFACE_ROOT}:/android/subsurface -w /android --name=${CONTAINER_NAME} subsurface/android-build-container:5.15.1 sleep infinity
docker create -v ${SUBSURFACE_ROOT}:/android/subsurface --name=${CONTAINER_NAME} subsurface/android-build:5.15.1 sleep infinity
fi
docker start ${CONTAINER_NAME}
BUILD_PARAMETERS=""
if [[ -n "${CONTAINER_ID}" ]]; then
BUILD_PARAMETERS="-quick"
BUILD_PARAMETERS="-quick"
else
# Prepare the image for first use
docker exec -t ${CONTAINER_NAME} rm /android/5.15.1/android/lib/cmake/Qt5Test/Qt5TestConfig.cmake
docker exec -t ${CONTAINER_NAME} apt-get install --reinstall cpp-7 gcc-7-base libgcc-7-dev libcc1-0 gcc-7
# Prepare the image for first use
# Set the git id
docker exec -t ${CONTAINER_NAME} git config --global user.name "${GIT_NAME}"
docker exec -t ${CONTAINER_NAME} git config --global user.email "${GIT_EMAIL}"
# Set the git id
docker exec -t ${CONTAINER_NAME} git config --global user.name "${GIT_NAME}"
docker exec -t ${CONTAINER_NAME} git config --global user.email "${GIT_EMAIL}"
fi
# Build. Do not rebuild the dependencies if this is not the first build
docker exec -t ${CONTAINER_NAME} /bin/bash -x ./subsurface/packaging/android/qmake-build.sh ${BUILD_PARAMETERS}
# Copy the output files into the 'android-debug' directory in the source directory
docker cp ${CONTAINER_NAME}:/android/subsurface-mobile-build/android-build/build/outputs/apk/debug/. ${SUBSURFACE_ROOT}/android-debug/
docker exec -e OUTPUT_DIR="/android/subsurface/android-debug" -t ${CONTAINER_NAME} /bin/bash -x ./subsurface/packaging/android/qmake-build.sh ${BUILD_PARAMETERS}
# Stop the container
docker stop ${CONTAINER_NAME}