From 0a7cf91f1a91751c1b62d94b112ff8c451802696 Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Thu, 29 May 2025 12:42:51 +0530 Subject: [PATCH 1/4] README: fix docker-src-dir default path fix Signed-off-by: Danish Prakash --- README.md | 4 ++-- configure.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0462469..5ca31b24 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ Given an emulator zip file and a system image zip file, we can build a directory that can be sent to `docker build` via the following invocation of `emu-docker`: emu-docker create [--dest docker-src-dir - (getcwd()/src by default)] + (getcwd()/bld/emulator by default)] This places all the right elements to run a docker image, but does not build, run or publish yet. A Linux emulator zip file must be used. @@ -195,7 +195,7 @@ run or publish yet. A Linux emulator zip file must be used. To build the Docker image corresponding to these emulators and system images: - docker build A Docker image ID will output; save this image ID. diff --git a/configure.sh b/configure.sh index bf37b170..f1dcc7c6 100755 --- a/configure.sh +++ b/configure.sh @@ -18,6 +18,7 @@ if [ "${BASH_SOURCE-}" = "$0" ]; then exit 33 fi +# prefer <= python3.12 if available. PYTHON=python3 VENV=.venv From 1f9f040eaa28a172da06384b80e884908e3ae564 Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Thu, 29 May 2025 12:43:29 +0530 Subject: [PATCH 2/4] create_web_container: prefer compose v2 and not v1 The script currently relies on compose v1 and fails if it's not intalled. Check whether compose v2 is installed and use it if available. Signed-off-by: Danish Prakash --- create_web_container.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/create_web_container.sh b/create_web_container.sh index 31f19d18..de5bac8a 100755 --- a/create_web_container.sh +++ b/create_web_container.sh @@ -95,18 +95,27 @@ generate_keys # Copy the private adbkey over cp ~/.android/adbkey js/docker/certs +# compose v1 (`docker-compose`) is no longer receiving updates, +# default to compose v2 (`docker compose`) if available. +if docker compose version >/dev/null 2>&1; then + DOCKER_COMPOSE="docker compose" +else + DOCKER_COMPOSE="docker-compose" +fi + + # compose the container python -m venv .docker-venv source .docker-venv/bin/activate pip install docker-compose -docker-compose -f ${DOCKER_YAML} build +$DOCKER_COMPOSE -f ${DOCKER_YAML} build rm js/docker/certs/adbkey if [ "${START}" = "yes" ]; then - docker-compose -f ${DOCKER_YAML} up + $DOCKER_COMPOSE -f ${DOCKER_YAML} up else echo "Created container, you can launch it as follows:" - echo "docker-compose -f ${DOCKER_YAML} up" + echo "$DOCKER_COMPOSE -f ${DOCKER_YAML} up" fi if [ "${INSTALL}" = "yes" ]; then From 7a0d7ed431b47150a9e141bbe2b34b0a804e0678 Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Thu, 29 May 2025 12:44:39 +0530 Subject: [PATCH 3/4] emu/containers: return emulator ID if image is not available locally If the image isn't available in the local docker store, an empty string is passed which is an invalid tag for docker build, replace that empty string with emulator ID. Signed-off-by: Danish Prakash --- emu/containers/docker_container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emu/containers/docker_container.py b/emu/containers/docker_container.py index 99e0e874..e01da831 100644 --- a/emu/containers/docker_container.py +++ b/emu/containers/docker_container.py @@ -162,7 +162,7 @@ def full_name(self) -> str: if local: return local.tags[0] - return "" + return self.image_name() def latest_name(self): if self.repo: From ff124afee6d806d30d449efb56079088e6282c4f Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Thu, 29 May 2025 12:46:22 +0530 Subject: [PATCH 4/4] emu/Dockerfile.emulator: replace ubuntu mirrors Signed-off-by: Danish Prakash --- emu/templates/Dockerfile.emulator | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emu/templates/Dockerfile.emulator b/emu/templates/Dockerfile.emulator index 82411c87..fd9eddae 100644 --- a/emu/templates/Dockerfile.emulator +++ b/emu/templates/Dockerfile.emulator @@ -13,6 +13,17 @@ # limitations under the License. FROM {{from_base_img}} AS emulator +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + echo "deb http://mirrors.kernel.org/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list && \ + echo "deb http://mirrors.kernel.org/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://mirrors.kernel.org/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo "deb http://mirrors.kernel.org/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ + echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries && \ + echo 'Acquire::http::Timeout "120";' >> /etc/apt/apt.conf.d/80-retries && \ + echo 'Acquire::https::Timeout "120";' >> /etc/apt/apt.conf.d/80-retries && \ + apt-get update --fix-missing + # Install all the required emulator dependencies. # You can get these by running ./android/scripts/unix/run_tests.sh --verbose --verbose --debs | grep apt | sort -u # pulse audio is needed due to some webrtc dependencies.