Skip to content

Improve gitlab-runner container image size

What does this MR do?

This MR removes unused architecture files in container build process

Why was this MR needed?

MR !3185 (merged) improved size using intermediate layer but there are still some files that can be cleaned

gitlab/gitlab-runner:alpine @ sha256:21e3237510a39b0cb4c68e8b7ae04cc5912c6b5b73d4e2969d4069ec2f655a04

find / -type f -exec ls -l {} + | sort -k 5
...
-rwxr-xr-x    1 root     root      53724821 Dec 17 20:43 /usr/bin/gitlab-runner-linux-arm64
-rwxr-xr-x    1 root     root      54665509 Dec 17 20:43 /usr/bin/gitlab-runner-linux-ppc64le
-rwxr-xr-x    1 root     root      56488373 Dec 17 20:43 /usr/bin/gitlab-runner
gitlab/gitlab-runner:latest @ sha256:d2db6b687e9cf5baf96009e43cc3eaebf180f634306cdc74e2400315d35f0dab

find / -type f -ls | sort -n -k7
...
  5780538  13104 -rw-r--r--   1 root     root     13414560 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-alpine-arm.tar.xz
  5780540  13404 -rw-r--r--   1 root     root     13722172 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-alpine-s390x.tar.xz
  5780539  13568 -rw-r--r--   1 root     root      13891272 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-alpine-arm64.tar.xz
  5780542  14808 -rw-r--r--   1 root     root      15160840 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-alpine-x86_64.tar.xz
     19147      0 -rw-------   1 root      root      16777216 Dec 21 18:45 /sys/devices/pci0000:00/0000:00:02.0/resource1
  5780291  33416 -rwxr-xr-x   1 root      root      34213952 Dec  7 14:46 /usr/bin/docker-machine
  5780543  34912 -rw-r--r--   1 root     root     35746396 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-arm.tar.xz
  5780546  35852 -rw-r--r--   1 root     root     36708436 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-s390x.tar.xz
  5780544  36704 -rw-r--r--   1 root     root     37578064 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-arm64.tar.xz
  5780548  39280 -rw-r--r--   1 root     root     40221584 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-x86_64.tar.xz
  5780545  40980 -rw-r--r--   1 root     root     41958860 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-ppc64le.tar.xz
  5780302  48072 -rwxr-xr-x   1 root     root      49225062 Dec 21 18:24 /usr/bin/gitlab-runner
  5780541  71416 -rw-r--r--   1 root     root      73125256 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-alpine-x86_64-pwsh.tar.xz
  5780547  98152 -rw-r--r--   1 root     root     100505300 Dec 17 18:02 /usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-x86_64-pwsh.tar.xz

What's the best way to test this MR?

What are the relevant issue numbers?

Merge request reports