Skip to content

Commit

Permalink
Attempt to write buildkit mirrors too
Browse files Browse the repository at this point in the history
  • Loading branch information
benbz committed Apr 12, 2024
1 parent 0a341fd commit fcb7ca7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions runner/entrypoint-dind-rootless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ trap graceful_stop TERM
log.notice "Writing out Docker config file"
/bin/bash <<SCRIPT
mkdir -p /home/runner/.config/docker/ /home/runner/.config/buildkit
if [ ! -f /home/runner/.config/docker/daemon.json ]; then
echo "{}" > /home/runner/.config/docker/daemon.json
fi
Expand All @@ -22,6 +23,10 @@ fi
if [ -n "${DOCKER_REGISTRY_MIRROR}" ]; then
jq ".\"registry-mirrors\"[0] = \"${DOCKER_REGISTRY_MIRROR}\"" /home/runner/.config/docker/daemon.json > /tmp/.daemon.json && mv /tmp/.daemon.json /home/runner/.config/docker/daemon.json
cat > /home/runner/.config/buildkit/buildkitd.toml <<- EOM
[registry."docker.io"]
mirrors = ["`echo "${DOCKER_REGISTRY_MIRROR}" | sed -e 's|^.*://||;s|/$||'`"]
EOM
fi
SCRIPT

Expand Down
12 changes: 11 additions & 1 deletion runner/entrypoint-dind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source graceful-stop.sh
trap graceful_stop TERM

sudo /bin/bash <<SCRIPT
mkdir -p /etc/docker
mkdir -p /etc/docker /etc/buildkit
if [ ! -f /etc/docker/daemon.json ]; then
echo "{}" > /etc/docker/daemon.json
Expand All @@ -22,10 +22,20 @@ fi
if [ -n "${DOCKER_REGISTRY_MIRROR}" ]; then
jq ".\"registry-mirrors\"[0] = \"${DOCKER_REGISTRY_MIRROR}\"" /etc/docker/daemon.json > /tmp/.daemon.json && mv /tmp/.daemon.json /etc/docker/daemon.json
cat > /etc/buildkit/buildkitd.toml <<- EOM
[registry."docker.io"]
mirrors = ["`echo "${DOCKER_REGISTRY_MIRROR}" | sed -e 's|^.*://||;s|/$||'`"]
EOM
fi
if [ -n "${DOCKER_INSECURE_REGISTRY}" ]; then
jq ".\"insecure-registries\"[0] = \"${DOCKER_INSECURE_REGISTRY}\"" /etc/docker/daemon.json > /tmp/.daemon.json && mv /tmp/.daemon.json /etc/docker/daemon.json
cat > /etc/buildkit/buildkitd.toml <<- EOM
[registry."docker.io"]
mirrors = ["`echo "${DOCKER_REGISTRY_MIRROR}" | sed -e 's|^.*://||;s|/$||'`"]
http = true
insecure = true
EOM
fi
SCRIPT

Expand Down

0 comments on commit fcb7ca7

Please sign in to comment.