1
0
android-container/README.md
James Ketrenos bf4956f5e0 Initial version
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
2024-06-24 16:50:06 -07:00

1.7 KiB

Android Development Container

This sets up development containers for Expo and Flutter using the Android SDK. The Dockerfile is derived from parts of thyrlian/android-sdk, with expo and flutter development infrastructure configured as well.

Build the Android SDK base container

This will seed the base container with an initial version of the Android SDK. After it is created, the SDK is copied to a volume bind mount on the host to allow multiple containers to use the same base SDK, as well as to perform SDK updates, upgrades, and additional package installations.

docker compose build

Seed the flutter repository

git clone https://github.com/flutter/flutter.git

Copy the base SDK to the mounted 'sdk' directory

docker compose run -it --rm \
    android-dev-container -- \
    bash -c 'cp -a $ANDROID_HOME/. /sdk/'

Install packages into SDK

The following will install Android platform 35:

ANDROID_PLATFORM=35
docker compose run -it --rm \
    android-dev-container -- \
    sdkmanager \
        "build-tools;${ANDROID_PLATFORM}.0.0" \
        "platforms;android-${ANDROID_PLATFORM}"

At this point, ./AndroidSDK contains the latest SDK. The docker-compose.yml for the android-dev-container will mount ./AndroidSDK to /opt/android-sdk.

To seed a new project (once per project)

PROJECT=foo
PROJECT_TYPE=expo # flutter
./seed.sh "${PROJECT_TYPE}" "${PROJECT}"

To develop

PROJECT=foo
PROJECT_TYPE=expo
./develop.sh "${PROJECT_TYPE}" "${PROJECT}"

To access the shell of the running project

PROJECT=foo
./shell.sh "${PROJECT}"

To stop development container

docker compose stop "${PROJECT}"