feat: expose if docker is enabled and wait for docker to be ready (#962)

Resolves #897
Resolves #915
This commit is contained in:
Callum Tait
2021-12-29 01:23:35 +00:00
committed by GitHub
parent c5950d75fa
commit ad48851dc9
8 changed files with 54 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
FROM ubuntu:20.04
ARG TARGETPLATFORM
ARG RUNNER_VERSION=2.280.3
ARG RUNNER_VERSION=2.286.0
ARG DOCKER_CHANNEL=stable
ARG DOCKER_VERSION=20.10.8
ARG DUMB_INIT_VERSION=1.2.5

View File

@@ -1,7 +1,7 @@
FROM ubuntu:20.04
ARG TARGETPLATFORM
ARG RUNNER_VERSION=2.280.3
ARG RUNNER_VERSION=2.286.0
ARG DOCKER_CHANNEL=stable
ARG DOCKER_VERSION=20.10.8
ARG DUMB_INIT_VERSION=1.2.5

View File

@@ -1,9 +1,10 @@
NAME ?= summerwind/actions-runner
DIND_RUNNER_NAME ?= ${NAME}-dind
DOCKER_USER ?= summerwind
NAME ?= ${DOCKER_USER}/actions-runner
DIND_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind
TAG ?= latest
TARGET_PLATFORM ?= $(shell arch)
TARGETPLATFORM ?= $(shell arch)
RUNNER_VERSION ?= 2.280.3
RUNNER_VERSION ?= 2.286.0
DOCKER_VERSION ?= 20.10.8
# default list of platforms for which multiarch image is built
@@ -24,8 +25,8 @@ else
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=${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-push-ubuntu:
docker push ${NAME}:${TAG}
@@ -39,12 +40,12 @@ docker-buildx-ubuntu:
docker buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-t "${NAME}:latest" \
-t "${NAME}:${TAG}" \
-f Dockerfile \
. ${PUSH_ARG}
docker buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-t "${DIND_RUNNER_NAME}:latest" \
-t "${DIND_RUNNER_NAME}:${TAG}" \
-f Dockerfile.dindrunner \
. ${PUSH_ARG}

View File

@@ -24,6 +24,13 @@ if [ ! -z "${STARTUP_DELAY_IN_SECONDS}" ]; then
sleep ${STARTUP_DELAY_IN_SECONDS}
fi
if [[ "${DISABLE_WAIT_FOR_DOCKER}" != "true" ]] && [[ "${DOCKER_ENABLED}" == "true" ]]; then
log "Docker enabled runner detected and Docker daemon wait is enabled"
log "Waiting until Docker is avaliable or the timeout is reached"
timeout 120s bash -c 'until docker ps ;do sleep 1; done'
else
log "Docker wait check skipped. Either Docker is disabled or the wait is disabled, continuing with entrypoint"
fi
if [ -z "${GITHUB_URL}" ]; then
log "Working with public GitHub"