Skip to content

Commit

Permalink
base image builder
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Mar 28, 2024
1 parent a68eba3 commit f74d2eb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/base-image.yml
Original file line number Diff line number Diff line change
@@ -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 }}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f74d2eb

Please sign in to comment.