Skip to content

Commit 34aade2

Browse files
committed
Decrease docker image size by 200MB
Copying and then deleting the docker directory in 2 steps (therefore, layers) means the docker directory is still present in the previous layer. We uncompress the docker.tgz in the /tmp directory to be able to copy the docker binaries directly to their target destination.
1 parent 2c03d74 commit 34aade2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

images/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN export RUNNER_ARCH=${TARGETARCH} \
2525
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \
2626
&& if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \
2727
&& curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
28-
&& tar zxvf docker.tgz \
28+
&& tar -C /tmp -zxvf docker.tgz \
2929
&& rm -rf docker.tgz \
3030
&& mkdir -p /usr/local/lib/docker/cli-plugins \
3131
&& curl -fLo /usr/local/lib/docker/cli-plugins/docker-buildx \
@@ -60,7 +60,6 @@ WORKDIR /home/runner
6060

6161
COPY --chown=runner:docker --from=build /actions-runner .
6262
COPY --from=build /usr/local/lib/docker/cli-plugins/docker-buildx /usr/local/lib/docker/cli-plugins/docker-buildx
63-
64-
RUN install -o root -g root -m 755 docker/* /usr/bin/ && rm -rf docker
63+
COPY --chown=root:root --chmod=755 --from=build /tmp/docker/* /usr/bin/
6564

6665
USER runner

0 commit comments

Comments
 (0)