Skip to content

Commit

Permalink
feat: install buildx plugin in dind runner
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Sep 21, 2021
1 parent 24602ff commit 200c76f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion runner/Dockerfile.dindrunner
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM ubuntu:20.04
ARG TARGETPLATFORM
ARG RUNNER_VERSION=2.280.3
ARG DOCKER_CHANNEL=stable
ARG DOCKER_VERSION=19.03.13
ARG DOCKER_VERSION=20.10.8
ARG DOCKER_BUILDX_VERSION=0.6.3
ARG DUMB_INIT_VERSION=1.2.5

RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
Expand Down Expand Up @@ -71,6 +72,14 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
mkdir -p /home/runner/.docker/cli-plugins; \
export BUILDX_ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2); \
if ! curl -L -o /home/runner/.docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-${BUILDX_ARCH}"; then \
echo >&2 "error: failed to download docker-buildx v${DOCKER_VERSION}'"; \
exit 1; \
fi; \
chown -R runner:docker /home/runner/.docker; \
chmod +x /home/runner/.docker/cli-plugins/docker-buildx; \
dockerd --version; \
docker --version

Expand Down
6 changes: 4 additions & 2 deletions runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TARGET_PLATFORM ?= $(shell arch)

RUNNER_VERSION ?= 2.280.3
DOCKER_VERSION ?= 20.10.8
DOCKER_BUILDX_VERSION ?= 0.6.3

# default list of platforms for which multiarch image is built
ifeq (${PLATFORMS}, )
Expand All @@ -15,7 +16,7 @@ endif
ifeq (${IMG_RESULT}, load)
export PUSH_ARG="--load"
# if load is specified, image will be built only for the build machine architecture.
export PLATFORMS="local"
#export PLATFORMS="local"
else ifeq (${IMG_RESULT}, cache)
# if cache is specified, image will only be available in the build cache, it won't be pushed or loaded
# therefore no PUSH_ARG will be specified
Expand All @@ -25,7 +26,7 @@ endif

docker-build-ubuntu:
docker build --build-arg TARGETPLATFORM=${TARGET_PLATFORM} --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${NAME}:${TAG} .
docker build --build-arg TARGETPLATFORM=${TARGET_PLATFORM} --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=${TARGET_PLATFORM} --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} --build-arg DOCKER_BUILDX_VERSION=${DOCKER_BUILDX_VERSION} -t ${DIND_RUNNER_NAME}:${TAG} -f Dockerfile.dindrunner .

docker-push-ubuntu:
docker push ${NAME}:${TAG}
Expand All @@ -45,6 +46,7 @@ docker-buildx-ubuntu:
docker buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
--build-arg DOCKER_BUILDX_VERSION=${DOCKER_BUILDX_VERSION} \
-t "${DIND_RUNNER_NAME}:latest" \
-f Dockerfile.dindrunner \
. ${PUSH_ARG}

0 comments on commit 200c76f

Please sign in to comment.