From 09049a513963926f9dab533a07f892ebac7161cc Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Thu, 28 Nov 2024 21:45:08 +0900 Subject: [PATCH] feat(docker): update cleanup scripts (#5497) * update cleanup scripts Signed-off-by: Yutaka Kondo * revert to ubuntu-22.04 Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .github/workflows/docker-build-and-push.yaml | 2 +- docker/scripts/cleanup_apt.sh | 8 ++++---- docker/scripts/cleanup_system.sh | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 4fbcb666b0..292b4753b5 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -65,7 +65,7 @@ jobs: docker-build-and-push-cuda: needs: [load-env, docker-build-and-push] - runs-on: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large + runs-on: ubuntu-22.04 steps: - name: Check out repository uses: actions/checkout@v4 diff --git a/docker/scripts/cleanup_apt.sh b/docker/scripts/cleanup_apt.sh index 0b0d43fea1..ad03c1f39e 100755 --- a/docker/scripts/cleanup_apt.sh +++ b/docker/scripts/cleanup_apt.sh @@ -1,10 +1,10 @@ #!/bin/bash function cleanup_apt() { - local remove_var_lib_apt_lists=$1 - apt-get autoremove -y && rm -rf "$HOME"/.cache - if [[ $remove_var_lib_apt_lists == true ]]; then - rm -rf /var/lib/apt/lists/* + local apt_clean=$1 + apt-get autoremove -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + if [[ $apt_clean == true ]]; then + apt-get clean fi } diff --git a/docker/scripts/cleanup_system.sh b/docker/scripts/cleanup_system.sh index 1e8d911bec..0833be2b3a 100755 --- a/docker/scripts/cleanup_system.sh +++ b/docker/scripts/cleanup_system.sh @@ -4,15 +4,15 @@ function cleanup_system() { local lib_dir=$1 local ros_distro=$2 - apt-get autoremove -y && rm -rf "$HOME"/.cache && - find /usr/lib/"$lib_dir"-linux-gnu -name "*.a" -type f -delete && + find /usr/lib/"$lib_dir"-linux-gnu -name "*.a" -type f -delete && find / -name "*.o" -type f -delete && find / -name "*.h" -type f -delete && find / -name "*.hpp" -type f -delete && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ros_distro"/include /etc/apt/sources.list.d/cuda*.list \ + /root/.local/pipx /opt/ros/"$ros_distro"/include /opt/autoware/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* } +./cleanup_apt.sh cleanup_system "$@"