Add docker login.
This commit is contained in:
parent
1daab2b5fc
commit
248cb76ac6
2 changed files with 22 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
FROM moby/buildkit
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
buildctl-deamonless.sh
|
||||
DOCKER_LOGIN_FILE_TMPL='{
|
||||
"auths": {
|
||||
"{{REGISTRY_URL}}": {
|
||||
"auth": "{{BASE64_UNAME_PW}}"
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
"$@"
|
||||
docker_login() {
|
||||
# TODO: detect registry url
|
||||
mkdir -p "$HOME/.docker"
|
||||
echo "$DOCKER_LOGIN_FILE_TMPL" | \
|
||||
sed -e "s|{{BASE64_UNAME_PW}}|$(printf '%s:%s' "$username" "$password" | base64)|g" \
|
||||
-e "s|{{REGISTRY_URL}}|https://index.docker.io/v1/|g" \
|
||||
> "$HOME/.docker/config.json"
|
||||
}
|
||||
|
||||
if [ -n "$username" ]; then
|
||||
docker_login
|
||||
fi
|
||||
|
||||
buildctl-daemonless.sh "$@"
|
||||
|
|
Reference in a new issue