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 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 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: 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.