From 2e7c001a2a8aac671334686f2c40dd50f69fe5cd Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Mon, 13 Aug 2018 17:04:49 +0200 Subject: [PATCH 1/2] Remove a massive amount of things we don't need --- Dockerfile | 90 ++------------------- Dockerfile-pinned | 8 -- _tmp/.gitkeep | 0 bitrise.yml | 194 --------------------------------------------- docker-compose.yml | 13 --- system_report.sh | 104 ------------------------ 6 files changed, 5 insertions(+), 404 deletions(-) delete mode 100644 Dockerfile-pinned delete mode 100644 _tmp/.gitkeep delete mode 100644 bitrise.yml delete mode 100644 docker-compose.yml delete mode 100644 system_report.sh diff --git a/Dockerfile b/Dockerfile index 774aa46..971bcb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/bitriseio/bitrise-base:alpha +FROM debian:stretch ENV ANDROID_HOME /opt/android-sdk-linux @@ -14,7 +14,7 @@ RUN apt-get update -qq # Dependencies to execute Android builds RUN dpkg --add-architecture i386 RUN apt-get update -qq -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-8-jdk libc6:i386 libstdc++6:i386 libgcc1:i386 libncurses5:i386 libz1:i386 +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget unzip openjdk-8-jdk libc6:i386 libstdc++6:i386 libgcc1:i386 libncurses5:i386 libz1:i386 # ------------------------------------------------------ @@ -41,7 +41,7 @@ ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME} RUN yes | sdkmanager --licenses # Platform tools -RUN sdkmanager "emulator" "tools" "platform-tools" +RUN sdkmanager "tools" "platform-tools" # SDKs # Please keep these in descending order! @@ -53,13 +53,6 @@ RUN yes | sdkmanager \ "platforms;android-27" \ "platforms;android-26" \ "platforms;android-25" \ - "platforms;android-24" \ - "platforms;android-23" \ - "platforms;android-22" \ - "platforms;android-21" \ - "platforms;android-19" \ - "platforms;android-17" \ - "platforms;android-15" \ "build-tools;28.0.1" \ "build-tools;28.0.0" \ "build-tools;27.0.3" \ @@ -69,26 +62,11 @@ RUN yes | sdkmanager \ "build-tools;26.0.2" \ "build-tools;26.0.1" \ "build-tools;25.0.3" \ - "build-tools;24.0.3" \ - "build-tools;23.0.3" \ - "build-tools;22.0.1" \ - "build-tools;21.1.2" \ - "build-tools;19.1.0" \ - "build-tools;17.0.0" \ - "system-images;android-28;google_apis;x86" \ - "system-images;android-26;google_apis;x86" \ - "system-images;android-25;google_apis;armeabi-v7a" \ - "system-images;android-24;default;armeabi-v7a" \ - "system-images;android-22;default;armeabi-v7a" \ - "system-images;android-19;default;armeabi-v7a" \ "extras;android;m2repository" \ "extras;google;m2repository" \ "extras;google;google_play_services" \ "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \ - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" \ - "add-ons;addon-google_apis-google-23" \ - "add-ons;addon-google_apis-google-22" \ - "add-ons;addon-google_apis-google-21" + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" # ------------------------------------------------------ # --- Install Gradle from PPA @@ -98,65 +76,7 @@ RUN apt-get update \ && apt-get -y install gradle \ && gradle -v -# ------------------------------------------------------ -# --- Install Maven 3 from PPA - -RUN apt-get purge maven maven2 \ - && apt-get update \ - && apt-get -y install maven \ - && mvn --version - - -# ------------------------------------------------------ -# --- Pre-install Ionic and Cordova CLIs - -RUN npm install -g ionic cordova - - -# ------------------------------------------------------ -# --- Install Fastlane - -RUN gem install fastlane --no-document \ - && fastlane --version - -# ------------------------------------------------------ -# --- Install Google Cloud SDK -# https://cloud.google.com/sdk/downloads -# Section: apt-get (Debian and Ubuntu only) -# -# E.g. for "Using Firebase Test Lab for Android from the gcloud Command Line": -# https://firebase.google.com/docs/test-lab/command-line -# - -RUN echo "deb https://packages.cloud.google.com/apt cloud-sdk-`lsb_release -c -s` main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list -RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - -RUN sudo apt-get update -qq \ - && sudo apt-get install -y -qq google-cloud-sdk - -ENV GCLOUD_SDK_CONFIG /usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/config.json - -# gcloud config doesn't update config.json. See the official Dockerfile for details: -# https://github.com/GoogleCloudPlatform/cloud-sdk-docker/blob/master/Dockerfile -RUN /usr/bin/gcloud config set --installation component_manager/disable_update_check true \ - && sed -i -- 's/\"disable_updater\": false/\"disable_updater\": true/g' $GCLOUD_SDK_CONFIG \ - && /usr/bin/gcloud config set --installation core/disable_usage_reporting true \ - && sed -i -- 's/\"disable_usage_reporting\": false/\"disable_usage_reporting\": true/g' $GCLOUD_SDK_CONFIG - - -# ------------------------------------------------------ -# --- Install additional packages - -# Required for Android ARM Emulator -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libqt5widgets5 -ENV QT_QPA_PLATFORM offscreen -ENV LD_LIBRARY_PATH ${ANDROID_HOME}/tools/lib64:${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib - - -# ------------------------------------------------------ -# --- Cleanup and rev num - # Cleaning RUN apt-get clean -ENV BITRISE_DOCKER_REV_NUMBER_ANDROID v2018_07_15_1 -CMD bitrise -version +CMD bash diff --git a/Dockerfile-pinned b/Dockerfile-pinned deleted file mode 100644 index 159b362..0000000 --- a/Dockerfile-pinned +++ /dev/null @@ -1,8 +0,0 @@ -# Once an "Alpha" is properly tested and declared as *production ready*, a "pinned" version is created -# and published. Pinned versions are considered production ready, and the "latest" pinned version -# is pre-cached on the [bitrise.io](https://www.bitrise.io/) Linux/Android Virtual Machines. -# Read more about how versions are handled in the `README.md`. - -FROM quay.io/bitriseio/android:alpha-v2018_08_09-09_55-b1206 - -CMD bitrise --version diff --git a/_tmp/.gitkeep b/_tmp/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/bitrise.yml b/bitrise.yml deleted file mode 100644 index db3d07d..0000000 --- a/bitrise.yml +++ /dev/null @@ -1,194 +0,0 @@ ---- -format_version: 1.1.0 -default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git -app: - envs: - - DOCKERHUB_IMG_ID_ALPHA: bitriseio/docker-android-alpha - - DOCKERHUB_IMG_ID_PINNED: bitriseio/docker-android - - DOCKER_FILE_PATH_ALPHA: ./Dockerfile - - DOCKER_FILE_PATH_PINNED: ./Dockerfile-pinned - # - - DOCKERHUB_IMG_ID: $DOCKERHUB_IMG_ID_ALPHA - - DOCKER_FILE_PATH: $DOCKER_FILE_PATH_ALPHA - # define in .bitrise.secrets.yml - - DOCKER_LOGIN_USER: $DOCKER_LOGIN_USER - - DOCKER_LOGIN_PASS: $DOCKER_LOGIN_PASS - # on CI - - SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL - - SLACK_CHANNEL: $SLACK_CHANNEL - # Quay - - QUAY_IMG_ID: quay.io/bitriseio/android - - QUAY_LOGIN_USER: $QUAY_LOGIN_USER - - QUAY_LOGIN_PASS: $QUAY_LOGIN_PASS - - IS_ALPHA: "true" - # optional - - CONFIG_do_not_deploy_latest_tag: $CONFIG_do_not_deploy_latest_tag - -workflows: - - # - # Main workflows - # - - # -- Rebuild / test - - rebuild-pinned: - before_run: - - _pinned_envs - after_run: - - _rebuild - - rebuild-alpha: - before_run: - - _alpha_envs - after_run: - - _rebuild - - # -- Deploy - - deploy-pinned: - before_run: - - _pinned_envs - after_run: - - _deploy - - deploy-alpha: - before_run: - - _alpha_envs - after_run: - - _deploy - - # - # Utility workflows - # - - _rebuild: - steps: - - script@1.1.0: - title: docker prune previous image versions - inputs: - - content: | - #!/usr/bin/env bash - set -ex - - docker rmi -f quay.io/bitriseio/android-ndk - docker rmi -f quay.io/bitriseio/android - - script@1.1.0: - title: docker infos & images - inputs: - - content: | - #!/bin/bash - set -ex - - docker images - df -kh ./ - docker info - - script@1.1.0: - title: docker build - inputs: - - content: | - #!/bin/bash - set -ex - - docker build --pull --no-cache -t "${DOCKERHUB_IMG_ID}:latest" --file "${DOCKER_FILE_PATH}" . - - docker images - - script@1.1.0: - title: run platform_report.sh - inputs: - - content: | - #!/bin/bash - set -ex - docker run --rm \ - -v "$(pwd)/system_report.sh:/bitrise/src/system_report.sh" \ - -v "/var/run/docker.sock:/var/run/docker.sock" \ - -v "$(which bitrise-bridge):/usr/local/bin/bitrise-bridge" \ - "${DOCKERHUB_IMG_ID}:latest" bash /bitrise/src/system_report.sh - - _pinned_envs: - envs: - - DOCKERHUB_IMG_ID: $DOCKERHUB_IMG_ID_PINNED - - DOCKER_FILE_PATH: $DOCKER_FILE_PATH_PINNED - - IS_ALPHA: "false" - _alpha_envs: - envs: - - DOCKERHUB_IMG_ID: $DOCKERHUB_IMG_ID_ALPHA - - DOCKER_FILE_PATH: $DOCKER_FILE_PATH_ALPHA - - IS_ALPHA: "true" - - _generate_image_deploy_tag: - steps: - - script: - inputs: - - content: | - #!/bin/bash - set -ex - envman add --key 'DOCKER_IMAGE_DEPLOY_TAG' --value "v$(date +%Y_%m_%d-%H_%M)-b${BITRISE_BUILD_NUMBER}" - - _deploy: - before_run: - - _generate_image_deploy_tag - - _rebuild - steps: - - script@1.1.0: - title: docker login - inputs: - - content: | - #!/bin/bash - set -e - echo "=> Docker login..." - docker login -u "${DOCKER_LOGIN_USER}" -p "${DOCKER_LOGIN_PASS}" - echo "=> Quay.io login..." - docker login -u "${QUAY_LOGIN_USER}" -p "${QUAY_LOGIN_PASS}" quay.io - - script@1.1.0: - title: docker push - inputs: - - content: | - #!/bin/bash - set -ex - - if [ -z "${DOCKER_IMAGE_DEPLOY_TAG}" ] ; then - echo " [!] No DOCKER_IMAGE_DEPLOY_TAG specified!" - exit 1 - fi - - ### Tags - # Docker Hub - docker tag "${DOCKERHUB_IMG_ID}:latest" "${DOCKERHUB_IMG_ID}:${DOCKER_IMAGE_DEPLOY_TAG}" - - # Quay.io - if [[ "${IS_ALPHA}" == "true" ]]; then - image_tag="alpha-${DOCKER_IMAGE_DEPLOY_TAG}" - latest_image_tag="alpha" - else - image_tag="${DOCKER_IMAGE_DEPLOY_TAG}" - latest_image_tag="latest" - fi - docker tag "${DOCKERHUB_IMG_ID}:latest" "${QUAY_IMG_ID}:${image_tag}" - docker tag "${DOCKERHUB_IMG_ID}:latest" "${QUAY_IMG_ID}:${latest_image_tag}" - - ### Push - # Docker Hub - docker push "${DOCKERHUB_IMG_ID}:${DOCKER_IMAGE_DEPLOY_TAG}" - docker push "${DOCKERHUB_IMG_ID}:latest" - - # Quay.io - docker push "${QUAY_IMG_ID}:${image_tag}" - docker push "${QUAY_IMG_ID}:${latest_image_tag}" - - slack@2.1.0: - run_if: '{{.IsCI | and .IsBuildFailed}}' - inputs: - - webhook_url: $SLACK_WEBHOOK_URL - - channel: $SLACK_CHANNEL - - from_username: "$BITRISE_APP_TITLE - OK" - - from_username_on_error: "$BITRISE_APP_TITLE - ERROR" - - message: | - Finished: - - - Branch: *$BITRISE_GIT_BRANCH* - - Tag: $BITRISE_GIT_TAG - - Image ID: $DOCKERHUB_IMG_ID - - Image tag: $DOCKER_IMAGE_DEPLOY_TAG - - Build URL: $BITRISE_BUILD_URL - - Build Number: $BITRISE_BUILD_NUMBER - - Build Message: $BITRISE_GIT_MESSAGE diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index d452a91..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -app: - build: . - command: bitrise --version - volumes: - - ./_tmp:/bitrise/tmp - - ./system_report.sh:/bitrise/src/system_report.sh - environment: - # => if you want your code to be git-cloned inside the container - CI: "true" - BITRISE_SOURCE_DIR: /bitrise/src - # => if you put your code into the _tmp folder - # CI: "false" - # BITRISE_SOURCE_DIR: /bitrise/tmp diff --git a/system_report.sh b/system_report.sh deleted file mode 100644 index 3ed88c0..0000000 --- a/system_report.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -set -e - -echo -echo '#' -echo '# This System Report was generated by: https://github.com/bitrise-docker/android/blob/master/system_report.sh' -echo '# Pull Requests are welcome!' -echo '#' -echo - -echo -echo "=== Revision / ID ======================" -echo "* BITRISE_DOCKER_REV_NUMBER_ANDROID: $BITRISE_DOCKER_REV_NUMBER_ANDROID" -echo "========================================" -echo - -# Make sure that the reported version is only -# a single line! -echo -echo "=== Pre-installed tool versions ========" - -ver_line="$(gradle --version | grep 'Gradle ')" ; echo "* Gradle: $ver_line" -ver_line="$(mvn --version | grep 'Apache Maven')" ; echo "* Maven: $ver_line" -ver_line="$( javac -version 2>&1 )" ; echo "* Java: $ver_line" - -if [[ ! -z "$BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK_LTS" ]] ; then - echo " (!) Cordova & Ionic are not preinstalled on this Stack / in this image" -else - ver_line="$(cordova --version)" ; echo "* Cordova CLI version: $ver_line" - ver_line="$(ionic --version)" ; echo "* Ionic CLI version: $ver_line" -fi - -echo "========================================" -echo - -echo -echo "=== Google Cloud SDK components ========" -if [[ ! -z "$BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK_LTS" ]] ; then - echo " (!) Not pre-installed on this Stack / in this image" -else - gcloud version -fi -echo "========================================" -echo - -echo -echo "=== Google Cloud Network Check =========" -if [[ ! -z "$BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK_LTS" ]] ; then - echo " (!) Not pre-installed on this Stack / in this image" -else - gcloud info --run-diagnostics -fi -echo "========================================" -echo - -echo -echo "=== Testing Android tools ==============" -echo " * adb path:" -which adb -echo -echo " * adb version:" -adb version -echo -echo " * SDK packages:" -if [[ ! -z "${BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK_LTS}" ]] ; then - echo " (!) Version check not available on this Stack / in this image" -else - grep ^Pkg.Revision ${ANDROID_HOME}/tools/source.properties | cut -d= -f 2 | xargs -I {} echo "* SDK Tools version: {}" - grep ^Pkg.Revision ${ANDROID_HOME}/platform-tools/source.properties | cut -d= -f 2 | xargs -I {} echo "* Platform Tools version: {}" - grep ^Pkg.Revision ${ANDROID_HOME}/emulator/source.properties | cut -d= -f 2 | xargs -I {} echo "* Emulator version: {}" -fi - -echo "========================================" -echo - -echo -echo "=== Android tools/dirs =================" -echo -echo "* ANDROID_HOME:" -ls -a1 ${ANDROID_HOME} -echo -echo "* ./platform-tools:" -ls -1 ${ANDROID_HOME}/platform-tools -echo -echo "* ./build-tools:" -ls -1 ${ANDROID_HOME}/build-tools -echo -echo "* ./emulator:" -if [[ ! -z "$BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK_LTS" ]] ; then - echo " (!) ./emulator dir does not exist on LTS" -else - ls -1 ${ANDROID_HOME}/emulator -fi -echo -echo "* ./extras:" -tree -L 2 ${ANDROID_HOME}/extras -echo -echo "* ./platforms:" -ls -1 ${ANDROID_HOME}/platforms -echo -echo "* ./system-images:" -tree -L 3 ${ANDROID_HOME}/system-images -echo "========================================" -echo From a70dc7aab7b6c8d2fae123ef37f8118581a239c7 Mon Sep 17 00:00:00 2001 From: Fabien L'heriau Date: Thu, 18 Oct 2018 12:13:30 +0200 Subject: [PATCH 2/2] Update the image to remove some unused tools and update others --- Dockerfile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 971bcb5..908e5bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,20 +53,15 @@ RUN yes | sdkmanager \ "platforms;android-27" \ "platforms;android-26" \ "platforms;android-25" \ - "build-tools;28.0.1" \ - "build-tools;28.0.0" \ + "build-tools;28.0.3" \ "build-tools;27.0.3" \ - "build-tools;27.0.2" \ - "build-tools;27.0.1" \ - "build-tools;27.0.0" \ "build-tools;26.0.2" \ - "build-tools;26.0.1" \ "build-tools;25.0.3" \ + "cmake;3.6.4111459" \ "extras;android;m2repository" \ "extras;google;m2repository" \ "extras;google;google_play_services" \ - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \ - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" # ------------------------------------------------------ # --- Install Gradle from PPA