Skip to content

Commit

Permalink
Docker: Do a little cleanup on docker and plugin installations
Browse files Browse the repository at this point in the history
  • Loading branch information
ccosby authored and Chris Cosby committed Jul 18, 2024
1 parent c9bae38 commit b886175
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ RUN apt update -y && apt install -y --no-install-recommends curl unzip

RUN export RUNNER_ARCH=${TARGETARCH} \
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \
&& curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
&& curl -fsSLo runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./runner.tar.gz \
&& rm runner.tar.gz

RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \
RUN curl -fsSLo runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \
&& unzip ./runner-container-hooks.zip -d ./k8s \
&& rm runner-container-hooks.zip

WORKDIR /actions-docker
WORKDIR /docker
RUN export RUNNER_ARCH=${TARGETARCH} \
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \
&& if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \
&& curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
&& curl -fsSLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
&& tar zxvf docker.tgz \
&& rm -rf docker.tgz \
&& mkdir -p /usr/local/lib/docker/cli-plugins \
&& curl -fLo /usr/local/lib/docker/cli-plugins/docker-buildx \
"https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-${TARGETARCH}" \
&& chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx
# Get CLI plugins
&& rm -rf plugins \
&& mkdir -p plugins \
# docker-buildx
&& curl -fsSLo plugins/docker-buildx "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-${TARGETARCH}"

# Configure git-core/ppa based on guidance here: https://git-scm.com/download/linux
# The second `apt update` isn't strictly necessary, but let's leave it here to force the
Expand All @@ -55,8 +56,8 @@ COPY --from=build /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/
COPY --from=build /etc/apt/trusted.gpg.d/*.gpg /etc/apt/trusted.gpg.d/

# Copy Docker files from build stage
COPY --from=build --chown=root:root --chmod=0755 /actions-docker/docker/* /usr/bin/
COPY --from=build /usr/local/lib/docker/cli-plugins/docker-buildx /usr/local/lib/docker/cli-plugins/docker-buildx
COPY --from=build --chown=root:root --chmod=0755 /docker/docker/* /usr/bin/
COPY --from=build --chown=root:root --chmod=0755 /docker/plugins/* /usr/local/lib/docker/cli-plugins/

# Install a sane set of base utilities
RUN apt update -y \
Expand Down

0 comments on commit b886175

Please sign in to comment.