1
0
android-container/README.md
James Ketrenos bf80f5e5ec Initial version
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
2024-12-10 17:51:59 -08:00

92 lines
2.1 KiB
Markdown

# 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](https://github.com/thyrlian/AndroidSDK), 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.
```bash
docker compose build
```
This will build the base 'android-sdk-manager' container as well as the unseeded
'android-dev-container'.
Inside the 'anrdoid-sdk-manager' container the directory '/sdk' will contain the original 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. The initial
seeding of the AndroidSDK on the host is performed via:
```bash
docker compose run -it --rm \
android-sdk-manager \
init
```
## Install packages into SDK
The following will install Android platform 35.
```bash
ANDROID_PLATFORM=35
docker compose run -it --rm \
android-sdk-manager -- \
sdkmanager \
"build-tools;${ANDROID_PLATFORM}.0.0" \
"platforms;android-${ANDROID_PLATFORM}" \
"platform-tools"
```
At this point, ./AndroidSDK contains the latest SDK. The docker-compose.yml
for the android-dev-container will mount ./AndroidSDK to /opt/android-sdk.
### Copy the base SDK to the mounted 'sdk' directory
```bash
docker compose run -it --rm \
android-dev-container -- \
bash -c 'cp -a $ANDROID_HOME/. /sdk/'
```
## Seed the flutter repository
```
git clone https://github.com/flutter/flutter.git
```
## To seed a new project (once per project)
```bash
PROJECT=foo
PROJECT_TYPE=expo # flutter
./seed.sh "${PROJECT_TYPE}" "${PROJECT}"
```
## To develop
```bash
PROJECT=foo
PROJECT_TYPE=expo
./develop.sh "${PROJECT_TYPE}" "${PROJECT}"
```
## To access the shell of the running project
```bash
PROJECT=foo
./shell.sh "${PROJECT}"
```
## To stop development container
```bash
docker compose stop "${PROJECT}"
```