Skip to content

Commit

Permalink
Add to default packages installed: curl git jq unzip
Browse files Browse the repository at this point in the history
These packages are used in a ton of actions on the marketplace. It would
be nice if they were installed and ready for use instead of having to
install them with `apt-get` on every single Github workflow.
  • Loading branch information
onedr0p authored and Chris Cosby committed Jun 6, 2024
1 parent 5991aad commit ed21baa
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ ARG RUNNER_CONTAINER_HOOKS_VERSION=0.6.0
ARG DOCKER_VERSION=25.0.5
ARG BUILDX_VERSION=0.13.1

RUN apt update -y && apt install curl unzip -y

WORKDIR /actions-runner

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 \
Expand Down Expand Up @@ -49,27 +50,32 @@ ENV RUNNER_MANUALLY_TRAP_SIG=1
ENV ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1
ENV ImageOS=ubuntu22

# Copy PPAs from build stage
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

# Install a sane set of base utilities
RUN apt update -y \
&& apt install -y --no-install-recommends sudo lsb-release \
&& apt install -y --no-install-recommends \
sudo lsb-release \
curl git jq unzip \
&& rm -rf /var/lib/apt/lists/*

RUN adduser --disabled-password --gecos "" --uid 1001 runner \
# Create the actions runner user and home directory
RUN adduser --home /home/runner --disabled-password --gecos "" --uid 1001 runner \
&& groupadd docker --gid 123 \
&& usermod -aG sudo runner \
&& usermod -aG docker runner \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

# 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 PPAs from build stage
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/
WORKDIR /home/runner

# Copy everything from /actions-runner in the build stage as our runner home
WORKDIR /home/runner
COPY --chown=runner:docker --from=build /actions-runner .

USER runner

0 comments on commit ed21baa

Please sign in to comment.