From f74d2ebeb2f7f1c2c97ece6499800689b5733d71 Mon Sep 17 00:00:00 2001 From: Abe Winter Date: Thu, 28 Mar 2024 13:53:56 -0400 Subject: [PATCH] base image builder --- .github/workflows/base-image.yml | 18 +++++++++++++++++ Dockerfile | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/base-image.yml create mode 100644 Dockerfile diff --git a/.github/workflows/base-image.yml b/.github/workflows/base-image.yml new file mode 100644 index 0000000..3fd3cd2 --- /dev/null +++ b/.github/workflows/base-image.yml @@ -0,0 +1,18 @@ +# build a docker image with android build tooling +on: + workflow_dispatch: + inputs: + image: + default: ghcr.io/viam-labs/rdk-apk + tag: + default: latest + +jobs: + base-image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: build + run: docker build -t ${{ inputs.image }}:${{ inputs.tag }} . + - name: push + run: docker push -t ${{ inputs.image }}:${{ inputs.tag }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..441fd03 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# base image for APK builds +FROM ubuntu:latest + +RUN --mount=type=cache,target=/var/cache/apt apt-get update +# sdkmanager requires 21 jre, we build on old jdk because we target old droid. (not sure old jdk is necessary though) +# make...python3 for tflite build +# nasm for x264 +# golang for rdk +RUN --mount=type=cache,target=/var/cache/apt apt-get install -qy \ + zip \ + openjdk-11-jdk-headless openjdk-21-jre-headless \ + make curl patch cmake git python3 \ + nasm \ + golang-1.21-go + +ENV ANDROID_HOME /droid +ENV ANDROID_SDK_ROOT /droid + +WORKDIR ${ANDROID_SDK_ROOT} + +# https://developer.android.com/studio#command-line-tools-only +ARG CLI_TOOLS=commandlinetools-linux-11076708_latest.zip +RUN curl --fail --silent --show-error -o ${CLI_TOOLS} https://dl.google.com/android/repository/${CLI_TOOLS} && unzip -q ${CLI_TOOLS} && rm ${CLI_TOOLS} + +ENV PATH ${PATH}:/droid/cmdline-tools/bin +ARG NDK_VERSION=26.2.11394342 +ENV NDK_ROOT ${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION} + +RUN yes | sdkmanager --sdk_root=$(realpath .) --install "platforms;android-28" "build-tools;26.0.3" "ndk;${NDK_VERSION}" + +ENV PATH ${PATH}:/usr/lib/go-1.21/bin:/root/go/bin + +RUN go install golang.org/x/mobile/cmd/gomobile@latest +RUN gomobile init