From cdc9d20e7ab831a27b4e4051964334c7e4985c5d Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Mon, 16 May 2022 04:41:28 +0200 Subject: [PATCH] Renamed Runner Dockerfiles (#1248) Renamed the runner dockerfiles so that we have proper syntax highlighting for them, as well as a consistent way to map from the image name to the dockerfile. Added a `.dockerignore` file to avoid uploading things to the daemon that we never use. --- .github/workflows/runners.yml | 8 ++--- runner/.dockerignore | 2 ++ runner/Makefile | 36 ++++++++++++------- ...drunner => actions-runner-dind.dockerfile} | 0 .../{Dockerfile => actions-runner.dockerfile} | 0 5 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 runner/.dockerignore rename runner/{Dockerfile.dindrunner => actions-runner-dind.dockerfile} (100%) rename runner/{Dockerfile => actions-runner.dockerfile} (100%) diff --git a/.github/workflows/runners.yml b/.github/workflows/runners.yml index c197e83a..30e94190 100644 --- a/.github/workflows/runners.yml +++ b/.github/workflows/runners.yml @@ -2,7 +2,7 @@ name: Runners on: pull_request: - types: + types: - opened - synchronize - reopened @@ -34,11 +34,9 @@ jobs: - name: actions-runner os-name: ubuntu os-version: 20.04 - dockerfile: Dockerfile - name: actions-runner-dind os-name: ubuntu os-version: 20.04 - dockerfile: Dockerfile.dindrunner steps: - name: Checkout @@ -47,7 +45,7 @@ jobs: - name: Setup Docker Environment id: vars uses: ./.github/actions/setup-docker-environment - with: + with: username: ${{ env.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} ghcr_username: ${{ github.actor }} @@ -57,7 +55,7 @@ jobs: uses: docker/build-push-action@c5e6528d5ddefc82f682165021e05edf58044bce with: context: ./runner - file: ./runner/${{ matrix.dockerfile }} + file: ./runner/${{ matrix.name }}.dockerfile platforms: linux/amd64,linux/arm64 push: ${{ github.ref == 'master' && github.event.pull_request.merged == true }} build-args: | diff --git a/runner/.dockerignore b/runner/.dockerignore new file mode 100644 index 00000000..f3e36c5c --- /dev/null +++ b/runner/.dockerignore @@ -0,0 +1,2 @@ +*.dockerfile +Makefile diff --git a/runner/Makefile b/runner/Makefile index 1c42511f..a69cb8e6 100644 --- a/runner/Makefile +++ b/runner/Makefile @@ -25,8 +25,18 @@ else endif docker-build-ubuntu: - docker build --build-arg TARGETPLATFORM=${TARGETPLATFORM} --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${NAME}:${TAG} . - docker build --build-arg TARGETPLATFORM=${TARGETPLATFORM} --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${DIND_RUNNER_NAME}:${TAG} -f Dockerfile.dindrunner . + docker build \ + --build-arg TARGETPLATFORM=${TARGETPLATFORM} \ + --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ + --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ + -f actions-runner.dockerfile \ + -t ${NAME}:${TAG} . + docker build \ + --build-arg TARGETPLATFORM=${TARGETPLATFORM} \ + --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ + --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ + -f actions-runner-dind.dockerfile \ + -t ${DIND_RUNNER_NAME}:${TAG} . docker-push-ubuntu: docker push ${NAME}:${TAG} @@ -36,17 +46,17 @@ docker-buildx-ubuntu: export DOCKER_CLI_EXPERIMENTAL=enabled ;\ export DOCKER_BUILDKIT=1 @if ! docker buildx ls | grep -q container-builder; then\ - docker buildx create --platform ${PLATFORMS} --name container-builder --use;\ + docker buildx create --platform ${PLATFORMS} --name container-builder --use;\ fi docker buildx build --platform ${PLATFORMS} \ - --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ - --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ - -t "${NAME}:${TAG}" \ - -f Dockerfile \ - . ${PUSH_ARG} + --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ + --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ + -f actions-runner.dockerfile \ + -t "${NAME}:${TAG}" \ + . ${PUSH_ARG} docker buildx build --platform ${PLATFORMS} \ - --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ - --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ - -t "${DIND_RUNNER_NAME}:${TAG}" \ - -f Dockerfile.dindrunner \ - . ${PUSH_ARG} + --build-arg RUNNER_VERSION=${RUNNER_VERSION} \ + --build-arg DOCKER_VERSION=${DOCKER_VERSION} \ + -f actions-runner-dind.dockerfile \ + -t "${DIND_RUNNER_NAME}:${TAG}" \ + . ${PUSH_ARG} diff --git a/runner/Dockerfile.dindrunner b/runner/actions-runner-dind.dockerfile similarity index 100% rename from runner/Dockerfile.dindrunner rename to runner/actions-runner-dind.dockerfile diff --git a/runner/Dockerfile b/runner/actions-runner.dockerfile similarity index 100% rename from runner/Dockerfile rename to runner/actions-runner.dockerfile