A Github Runner Container Docker Hook for DooD based on actions/runner-container-hooks
This is a custom runner container hook that can be used to execute docker containers in containerized self hosted runner environments. It is meant to be used in a Docker-out-of-Docker scenario (docker socket sharing) and addresses the issue of runner context sharing. With a DooD setup it is not posible to share the github runner context (workspace) with the docker runner container since the containers are created by the host:
In your Github Actions Docker Runner Dockerfile:
FROM ghcr.io/alexander-heimbuch/github-runner-container-hooks:latest as runnerContainerHooks
COPY --from=runnerContainerHooks /static/runner_container_hooks.js /runner_container_hooks.js
# Adapt accordingly
ENV RUNNER_HOME=/home/docker/actions-runner/
ENV ACTIONS_RUNNER_CONTAINER_HOOKS=/runner_container_hooks.js
Instead of using the default system mounts this variant of Container Hooks creates a docker volume for each required context (_work, externals, _github_home and _github_workflow). Before a job starts the current job context is copied into the volume.