use alpine's coreutils base64, which supports -w 0 to avoid wrapping -- thanks @miihael

This commit is contained in:
ricardop
2020-04-03 14:06:19 +02:00
parent e72389b690
commit 72dc9a8819
2 changed files with 2 additions and 3 deletions

View File

@@ -57,8 +57,7 @@ if [ "$AUTH_REGISTRIES" ]; then
AUTH_HOST="${registry_array[0]}"
AUTH_USER="${registry_array[1]}"
AUTH_PASS="${registry_array[2]}"
# make base64 not wrap lines: https://superuser.com/a/1225334
AUTH_BASE64=$(echo -n "${AUTH_USER}:${AUTH_PASS}" | base64 | tr -d \\n )
AUTH_BASE64=$(echo -n ${AUTH_USER}:${AUTH_PASS} | base64 -w0 | xargs)
echo "Adding Auth for registry '${AUTH_HOST}' with user '${AUTH_USER}'."
echo "\"${AUTH_HOST}\" \"${AUTH_BASE64}\";" >> /etc/nginx/docker.auth.map
done