Skip to content

Commit

Permalink
Refactor naming convention for directories and files
Browse files Browse the repository at this point in the history
  • Loading branch information
thyrlian committed Sep 29, 2024
1 parent 05ae7df commit 9d8fce1
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
- name: Build the main Docker image (android-sdk)
run: docker build -t android-sdk ./android-sdk
- name: Display tool version information of the main Docker image (android-sdk)
run: cmd=$(cat ./android-sdk/version_inspector.sh) && docker run -i --rm android-sdk bash -c "$cmd"
run: cmd=$(cat ./android-sdk/version-inspector.sh) && docker run -i --rm android-sdk bash -c "$cmd"
- name: Build the sub Docker image (android-sdk-vnc)
run: docker build -t android-sdk-vnc ./android-sdk/vnc
- name: Display tool version information of the sub Docker image (android-sdk-vnc)
run: cmd=$(cat ./android-sdk/vnc/version_inspector.sh) && docker run -i --rm android-sdk-vnc bash -c "$cmd"
run: cmd=$(cat ./android-sdk/vnc/version-inspector.sh) && docker run -i --rm android-sdk-vnc bash -c "$cmd"
- name: Build the sub Docker image (android-sdk-firebase-test-lab)
run: docker build -t android-sdk-firebase-test-lab ./android-sdk/firebase-test-lab
- name: Display tool version information of the sub Docker image (android-sdk-firebase-test-lab)
run: cmd=$(cat ./android-sdk/firebase-test-lab/version_inspector.sh) && docker run -i --rm android-sdk-firebase-test-lab bash -c "$cmd"
run: cmd=$(cat ./android-sdk/firebase-test-lab/version-inspector.sh) && docker run -i --rm android-sdk-firebase-test-lab bash -c "$cmd"
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Contributions are made by forking this repository, making the changes, and openi
The [primary Docker image](./android-sdk/Dockerfile) was created in barebone, for the sake of providing Android environment only. If you have other needs, please build a dedicated Docker image:

* Create a specific directory under [android-sdk](./android-sdk) directory and a `Dockerfile` inside it.
* A `version_inspector.sh` file is necessary to print out tools' version information.
* A `version-inspector.sh` file is necessary to print out tools' version information.
* Update corresponding CI workflow: [GitHub Action](https://github.com/thyrlian/AndroidSDK/blob/master/.github/workflows/docker-image.yml).
* Add corresponding Docker image building and publishing steps to [`image_publisher.sh`](./image_publisher.sh) script.
* Add corresponding Docker image building and publishing steps to [`image-publisher.sh`](./image-publisher.sh) script.

## Accept New SDK Licenses

Update the script [`android-sdk/license_acceptor.sh`](./android-sdk/license_accepter.sh) with the new agreement checksums. Do not remove pre-existing license agreement acceptances.
Update the script [`android-sdk/license-accepter.sh`](./android-sdk/license-accepter.sh) with the new agreement checksums. Do not remove pre-existing license agreement acceptances.

If a new agreement is accepted, a file should be created in the directory [`EULA`](./EULA). If there is an update, ensure the agreements contain a suffix with the timestamp in the format `-YYYYMMDD`.

Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Android SDK development environment Docker image

[![Docker Badge](https://dockerico.blankenship.io/image/thyrlian/android-sdk)](https://hub.docker.com/r/thyrlian/android-sdk)

<img src="https://github.com/thyrlian/AndroidSDK/blob/master/images/logo.png?raw=true" width="200">
<img src="https://github.com/thyrlian/AndroidSDK/blob/master/assets/logo.png?raw=true" width="200">

<a href="https://youtu.be/YwBAqMDYFCU"><img src="https://pbs.twimg.com/media/DODnbwmXkAAbXuM.jpg" alt="Conference Talk" width="600"></a>

Expand Down Expand Up @@ -146,7 +146,7 @@ docker run -it -v $(pwd)/sdk:/opt/android-sdk:ro thyrlian/android-sdk /bin/bash
docker run -it -v $(pwd)/sdk:/opt/android-sdk thyrlian/android-sdk /bin/bash

# to keep and reuse Gradle cache
docker run -it -v $(pwd)/sdk:/opt/android-sdk -v $(pwd)/gradle_caches:/root/.gradle/caches thyrlian/android-sdk /bin/bash
docker run -it -v $(pwd)/sdk:/opt/android-sdk -v $(pwd)/gradle-caches:/root/.gradle/caches thyrlian/android-sdk /bin/bash

# to stop and remove container
# when the image was pulled from a registry
Expand All @@ -159,7 +159,7 @@ docker stop $(docker ps -a | grep 'android-sdk' | awk '{ print $1 }') &> /dev/nu

### Accepting Licenses

A helper script is provided at [`/opt/license_accepter.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/license_accepter.sh) for accepting the SDK and its various licenses. This is helpful in non-interactive environments such as CI builds.
A helper script is provided at [`/opt/license-accepter.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/license-accepter.sh) for accepting the SDK and its various licenses. This is helpful in non-interactive environments such as CI builds.

## SSH

Expand All @@ -168,9 +168,9 @@ It is also possible if you wanna connect to container via SSH. There are three
* Build an image on your own, with a built-in `authorized_keys`

```bash
# Put your `id_rsa.pub` under `android-sdk/accredited_keys` directory (as many as you want)
# Put your `id_rsa.pub` under `android-sdk/accredited-keys` directory (as many as you want)

# Build an image, then an `authorized_keys` file will be composed automatically, based on the keys from `android-sdk/accredited_keys` directory
# Build an image, then an `authorized_keys` file will be composed automatically, based on the keys from `android-sdk/accredited-keys` directory
docker build -t android-sdk android-sdk

# Run a container
Expand Down Expand Up @@ -216,7 +216,7 @@ And, in case you need, you can still attach to the running container (not via ss
docker exec -it <container_id> /bin/bash
```

<img src="https://github.com/thyrlian/AndroidSDK/blob/master/images/SSH.png?raw=true">
<img src="https://github.com/thyrlian/AndroidSDK/blob/master/assets/SSH.png?raw=true">

## VNC

Expand Down Expand Up @@ -249,7 +249,7 @@ emulator -avd test -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect &

For more details, please refer to [Emulator section](https://github.com/thyrlian/AndroidSDK#emulator).

<img src="https://github.com/thyrlian/AndroidSDK/blob/master/images/vnc.png?raw=true">
<img src="https://github.com/thyrlian/AndroidSDK/blob/master/assets/vnc.png?raw=true">

### VNC client recommendation

Expand Down Expand Up @@ -306,10 +306,10 @@ Fortunately, you can easily build such a mirror server docker image on your own.
docker build --build-arg GRADLE_DOWNLOAD_AMOUNT=<amount_of_gradle_distributions_to_be_downloaded> -t gradle-server gradle-server
```

Preferably, you should run the [download script](https://github.com/thyrlian/AndroidSDK/blob/master/gradle-server/gradle_downloader.sh) locally, and mount the download directory to the container.
Preferably, you should run the [download script](https://github.com/thyrlian/AndroidSDK/blob/master/gradle-server/gradle-downloader.sh) locally, and mount the download directory to the container.

```bash
gradle-server/gradle_downloader.sh [DOWNLOAD_DIRECTORY] [DOWNLOAD_AMOUNT]
gradle-server/gradle-downloader.sh [DOWNLOAD_DIRECTORY] [DOWNLOAD_AMOUNT]
docker run -d -p 80:80 -p 443:443 -v [DOWNLOAD_DIRECTORY]:/var/www/gradle.org/public_html/distributions gradle-server
```

Expand Down Expand Up @@ -521,7 +521,7 @@ Now you can for instance run UI tests on the emulator (just remember, the perfor

If you encounter an error "***Process system isn't responding***" in the emulator, like below:

<img src="https://github.com/thyrlian/AndroidSDK/blob/master/images/emulator_error_process_not_responding.png?raw=true">
<img src="https://github.com/thyrlian/AndroidSDK/blob/master/assets/emulator-error-process-not-responding.png?raw=true">

You could try:

Expand Down Expand Up @@ -627,9 +627,9 @@ docker pull thyrlian/android-sdk-firebase-test-lab
# we'll persist all your gcloud configuration which would be created at ~/.config/gcloud/

# spin up a container with interactive mode
docker run -it -v $(pwd)/sdk:/opt/android-sdk -v <your_private_key_dir>/firebase.json:/root/firebase.json -v $(pwd)/gcloud_config:/root/.config/gcloud thyrlian/android-sdk-firebase-test-lab /bin/bash
docker run -it -v $(pwd)/sdk:/opt/android-sdk -v <your_private_key_dir>/firebase.json:/root/firebase.json -v $(pwd)/gcloud-config:/root/.config/gcloud thyrlian/android-sdk-firebase-test-lab /bin/bash
# or spin up a container with SSH
docker run -d -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk -v <your_private_key_dir>/firebase.json:/root/firebase.json -v $(pwd)/gcloud_config:/root/.config/gcloud -v $(pwd)/authorized_keys:/root/.ssh/authorized_keys thyrlian/android-sdk-firebase-test-lab
docker run -d -p 2222:22 -v $(pwd)/sdk:/opt/android-sdk -v <your_private_key_dir>/firebase.json:/root/firebase.json -v $(pwd)/gcloud-config:/root/.config/gcloud -v $(pwd)/authorized_keys:/root/.ssh/authorized_keys thyrlian/android-sdk-firebase-test-lab

# authorize access to Google Cloud Platform with a service account (by its private key)
gcloud auth activate-service-account -q --key-file /root/firebase.json
Expand Down Expand Up @@ -883,16 +883,16 @@ sudo netstat -tulpn | grep LISTEN
* Go to the top-level directory of this project
* Execute [`image_publisher.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/image_publisher.sh) script
* Execute [`image-publisher.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/image-publisher.sh) script
```console
./image_publisher.sh [TAG]
./image-publisher.sh [TAG]
```
* Execute [`version_inspector.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/version_inspector.sh) script inside a docker container from local machine to check versions of tools
* Execute [`version-inspector.sh`](https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/version-inspector.sh) script inside a docker container from local machine to check versions of tools
```console
cmd=$(cat ./android-sdk/version_inspector.sh) && docker run -it --rm android-sdk bash -c "$cmd"
cmd=$(cat ./android-sdk/version-inspector.sh) && docker run -it --rm android-sdk bash -c "$cmd"
```
* Update [Changelog](https://github.com/thyrlian/AndroidSDK/blob/master/CHANGELOG.md) based on the versions info printed by the above commands
Expand Down
6 changes: 3 additions & 3 deletions android-sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ ENV LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib6
ENV QTWEBENGINE_DISABLE_SANDBOX=1

# accept the license agreements of the SDK components
ADD license_accepter.sh /opt/
RUN chmod +x /opt/license_accepter.sh && /opt/license_accepter.sh $ANDROID_HOME
ADD license-accepter.sh /opt/
RUN chmod +x /opt/license-accepter.sh && /opt/license-accepter.sh $ANDROID_HOME

# setup adb server
EXPOSE 5037

# install and configure SSH server
EXPOSE 22
ADD sshd-banner /etc/ssh/
ADD accredited_keys /tmp/
ADD accredited-keys /tmp/
RUN apt-get update && \
apt-get install -y --no-install-recommends openssh-server supervisor locales && \
mkdir -p /var/run/sshd /var/log/supervisord && \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions android-sdk/vnc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ LABEL maintainer="[email protected]"
ENV USER=root
ENV DISPLAY=:1
EXPOSE 5901
ADD vncpass.sh /tmp/
ADD vncserver_daemon.sh /usr/local/bin/
ADD vnc-pass.sh /tmp/
ADD vncserver-daemon.sh /usr/local/bin/
ADD watchdog.sh /usr/local/bin/
ADD supervisord_vncserver.conf /etc/supervisor/conf.d/
ADD supervisord-vncserver.conf /etc/supervisor/conf.d/
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends xfce4 xfce4-goodies xfonts-base dbus-x11 tightvncserver expect xauth && \
touch /root/.Xauthority && chmod 600 /root/.Xauthority && \
xauth generate :1 . trusted && \
chmod +x /usr/local/bin/vncserver_daemon.sh && \
chmod +x /tmp/vncpass.sh; sync && \
/tmp/vncpass.sh && \
rm /tmp/vncpass.sh && \
chmod +x /usr/local/bin/vncserver-daemon.sh && \
chmod +x /tmp/vnc-pass.sh; sync && \
/tmp/vnc-pass.sh && \
rm /tmp/vnc-pass.sh && \
apt-get remove -y expect && apt-get autoremove -y && \
FILE_SSH_ENV="/root/.ssh/environment" && \
echo "DISPLAY=:1" >> $FILE_SSH_ENV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pidfile=/var/run/supervisord.pid
user=root

[program:vncserver]
command = /usr/local/bin/vncserver_daemon.sh
command = /usr/local/bin/vncserver-daemon.sh
user=root
autostart=true
autorestart=true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 3 additions & 3 deletions gradle-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt-get update && \
# install and configure the Apache Web Server
ARG GRADLE_DOWNLOAD_AMOUNT=14
ENV GRADLE_DIST /var/www/gradle.org/public_html/distributions
ADD gradle_downloader.sh $GRADLE_DIST/
ADD gradle-downloader.sh $GRADLE_DIST/
RUN apt-get install -y apache2 && \
sed -i 's%\(^\s*DocumentRoot\s*\).*%\1/var/www/gradle.org/public_html%g' /etc/apache2/sites-available/000-default.conf && \
echo "\n<Directory /var/www/gradle.org>\n Options Indexes FollowSymLinks\n</Directory>\n" >> /etc/apache2/apache2.conf && \
Expand All @@ -28,7 +28,7 @@ RUN apt-get install -y apache2 && \
sed -i 's%\(^\s*SSLCertificateFile\s*\).*%\1/etc/apache2/ssl/apache.crt%g' /etc/apache2/sites-available/default-ssl.conf && \
sed -i 's%\(^\s*SSLCertificateKeyFile\s*\).*%\1/etc/apache2/ssl/apache.key%g' /etc/apache2/sites-available/default-ssl.conf && \
a2ensite default-ssl.conf && \
chmod +x $GRADLE_DIST/gradle_downloader.sh && \
$GRADLE_DIST/gradle_downloader.sh $GRADLE_DIST $GRADLE_DOWNLOAD_AMOUNT
chmod +x $GRADLE_DIST/gradle-downloader.sh && \
$GRADLE_DIST/gradle-downloader.sh $GRADLE_DIST $GRADLE_DOWNLOAD_AMOUNT
EXPOSE 80 443
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
File renamed without changes.
8 changes: 4 additions & 4 deletions image_publisher.sh → image-publisher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ SUB_IMAGE_VNC_DIR=vnc
SUB_IMAGE_FIREBASE_TEST_LAB_NAME=android-sdk-firebase-test-lab
SUB_IMAGE_FIREBASE_TEST_LAB_DIR=firebase-test-lab
TAG_LATEST=latest
KEYS_DIR=accredited_keys
TEMP_DIR=temp_accredited_keys
KEYS_DIR=accredited-keys
TEMP_DIR=temp-accredited-keys

# extract base image name and tag from Dockerfile
regex_name_and_tag='FROM[[:blank:]]([^:]*):([^:]*)'
Expand All @@ -36,7 +36,7 @@ cd $MAIN_IMAGE_DIR
echo "Pulling the latest base image..."
docker pull $BASE_IMAGE_NAME:$BASE_IMAGE_TAG

echo "Hiding files inside accredited_keys directory..."
echo "Hiding files inside accredited-keys directory..."
rm -r $TEMP_DIR 2> /dev/null
mkdir -p $TEMP_DIR
if [ ! -z "$(ls $KEYS_DIR)" ]; then
Expand Down Expand Up @@ -100,7 +100,7 @@ echo "Pushing the sub Firebase Test Lab image to Docker Hub..."
docker push $DOCKER_HUB_ACCOUNT/$SUB_IMAGE_FIREBASE_TEST_LAB_NAME:$TAG
docker push $DOCKER_HUB_ACCOUNT/$SUB_IMAGE_FIREBASE_TEST_LAB_NAME:$TAG_LATEST

echo "Unhiding files inside accredited_keys directory..."
echo "Unhiding files inside accredited-keys directory..."
if [ ! -z "$(ls $TEMP_DIR)" ]; then
mv -v $TEMP_DIR/* $KEYS_DIR
fi
Expand Down

0 comments on commit 9d8fce1

Please sign in to comment.