mirror of
https://github.com/docker/setup-buildx-action.git
synced 2026-03-16 14:17:15 +08:00
Add Docker Hub proxy cache mirror config for buildkit pods
Reads BP_DOCKERHUB_PROXY env var and injects it as a mirror for docker.io in the buildkit TOML config. Fixes 504 Gateway Timeout on IPv6 clusters that cannot reach registry-1.docker.io directly.
This commit is contained in:
parent
837f59bf50
commit
bec8517ed4
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -130,6 +130,20 @@ function addClusterLocalRegistryConfig(buildkitConfig: string): string {
|
||||
};
|
||||
}
|
||||
|
||||
const dockerhubProxy = process.env.BP_DOCKERHUB_PROXY;
|
||||
if (dockerhubProxy && dockerhubProxy.length) {
|
||||
if (!inlineToml['registry']['docker.io']) {
|
||||
inlineToml['registry']['docker.io'] = {};
|
||||
}
|
||||
inlineToml['registry']['docker.io']['mirrors'] = [dockerhubProxy];
|
||||
|
||||
if (!inlineToml['registry'][dockerhubProxy]) {
|
||||
inlineToml['registry'][dockerhubProxy] = {};
|
||||
}
|
||||
inlineToml['registry'][dockerhubProxy]['http'] = true;
|
||||
inlineToml['registry'][dockerhubProxy]['insecure'] = true;
|
||||
}
|
||||
|
||||
return TOML.stringify(inlineToml);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user