Add rootless runner to the Makefile and improve target platform handling. (#2005)

* Add rootless runner to the Makefile and improve target platform handling

* Add rootless image to docker-push-ubuntu target

* Update runner/Makefile

* Update runner/actions-runner-dind-rootless.dockerfile

* Update runner/actions-runner-dind.dockerfile

* Update runner/actions-runner.dockerfile

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Igor Sarkisov 2022-11-26 01:10:26 -08:00 committed by GitHub
parent 5e8f576f65
commit 95c324b550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -27,7 +27,19 @@ else
export PUSH_ARG="--push"
endif
docker-build-ubuntu:
check-target-platform:
# Handle target platform variants.
# arch command on OS X reports "i386" for Intel CPUs regardless of bitness
ifeq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM), x86_64 x64 amd64 i386 linux/amd64))
TARGETPLATFORM = linux/amd64
else ifeq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM), arm64 aarch64 linux/arm64))
TARGETPLATFORM = linux/arm64
else
$(warning Unsupported target platform $(TARGETPLATFORM))
$(error Supported target platforms: linux/amd64 and linux/arm64)
endif
docker-build-ubuntu: check-target-platform
${DOCKER} build \
--build-arg TARGETPLATFORM=${TARGETPLATFORM} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
@ -44,7 +56,6 @@ docker-build-ubuntu:
${DOCKER} build \
--build-arg TARGETPLATFORM=${TARGETPLATFORM} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.dockerfile \
-t ${DIND_ROOTLESS_RUNNER_NAME}:${TAG} .
@ -74,3 +85,9 @@ docker-buildx-ubuntu:
-f actions-runner-dind.dockerfile \
-t "${DIND_RUNNER_NAME}:${TAG}" \
. ${PUSH_ARG}
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${TAG}" \
. ${PUSH_ARG}