Skip to content

Commit b5af93d

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 e640a9f commit b5af93d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: 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 \
@@ -61,7 +61,6 @@ WORKDIR /home/runner
6161

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

6766
USER runner

0 commit comments

Comments
 (0)