diff options
author | eitsupi <50911393+eitsupi@users.noreply.github.com> | 2022-10-11 01:33:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 01:33:01 +0300 |
commit | a8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch) | |
tree | 73dd647775325582c17a452816457f5cec82004d /src/docker-in-docker | |
parent | 065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff) |
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists
* bump versions
Diffstat (limited to 'src/docker-in-docker')
-rw-r--r-- | src/docker-in-docker/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/docker-in-docker/install.sh | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/docker-in-docker/devcontainer-feature.json b/src/docker-in-docker/devcontainer-feature.json index 8538b46..5ed236c 100644 --- a/src/docker-in-docker/devcontainer-feature.json +++ b/src/docker-in-docker/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "docker-in-docker", - "version": "1.0.5", + "version": "1.0.6", "name": "Docker (Docker-in-Docker)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker", "description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.", diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh index afcdc1a..edcc221 100755 --- a/src/docker-in-docker/install.sh +++ b/src/docker-in-docker/install.sh @@ -23,6 +23,9 @@ DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute # Default: Exit on any failure. set -e +# Clean up +rm -rf /var/lib/apt/lists/* + # Setup STDERR. err() { echo "(!) $*" >&2 @@ -72,8 +75,10 @@ get_common_setting() { apt_get_update() { - echo "Running apt-get update..." - apt-get update -y + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi } # Checks if packages are installed and installs them if not @@ -154,8 +159,7 @@ fi # Install dependencies check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr if ! type git > /dev/null 2>&1; then - apt_get_update - apt-get -y install git + check_packages git fi # Swap to legacy iptables for compatibility @@ -249,10 +253,7 @@ else fi if [ "${target_compose_arch}" != "x86_64" ]; then # Use pip to get a version that runs on this architecture - if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then - apt_get_update - apt-get -y install python3-minimal python3-pip libffi-dev python3-venv - fi + check_packages python3-minimal python3-pip libffi-dev python3-venv export PIPX_HOME=/usr/local/pipx mkdir -p ${PIPX_HOME} export PIPX_BIN_DIR=/usr/local/bin @@ -299,6 +300,8 @@ fi # If init file already exists, exit if [ -f "/usr/local/share/docker-init.sh" ]; then echo "/usr/local/share/docker-init.sh already exists, so exiting." + # Clean up + rm -rf /var/lib/apt/lists/* exit 0 fi echo "docker-init doesnt exist, adding..." @@ -398,4 +401,7 @@ EOF chmod +x /usr/local/share/docker-init.sh chown ${USERNAME}:root /usr/local/share/docker-init.sh +# Clean up +rm -rf /var/lib/apt/lists/* + echo 'docker-in-docker-debian script has completed!' |