diff --git a/bin/entrypoint b/bin/entrypoint index 12417e13..49416218 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -10,11 +10,20 @@ fi if [ -n "${REGISTRY_URL}" ] ; then sed -i "s,\${REGISTRY_URL},${REGISTRY_URL}," /etc/nginx/conf.d/default.conf + HOST=$(echo ${REGISTRY_URL} | sed "s,http[s]*://,,") + sed -i "s,\${HOST},${HOST}," /etc/nginx/conf.d/default.conf sed -i "s,#!,," /etc/nginx/conf.d/default.conf + + if [ -f ${CREDS_FILE} ] ; then + CREDENTIALS=$(cat ${CREDS_FILE} | tr -d \\n) + BASIC_AUTH=$(echo -n "${CREDENTIALS}" | base64 | tr -d \\n) + sed -i "s,\${BASIC_AUTH},${BASIC_AUTH}," /etc/nginx/conf.d/default.conf + sed -i "s,##,," /etc/nginx/conf.d/default.conf + fi fi if [ -z "$@" ]; then nginx -g "daemon off;" else $@ -fi +fi \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf index 91b86d31..bcae1dbf 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -25,6 +25,9 @@ server { #! return 404; #! } #! proxy_pass ${REGISTRY_URL}; +#! proxy_set_header Host ${HOST}; +## # Allow for authentication for access to backend registry +## proxy_set_header Authorization "Basic ${BASIC_AUTH}"; #! } #error_page 404 /404.html; @@ -42,4 +45,4 @@ server { #location ~ /\.ht { # deny all; #} -} +} \ No newline at end of file diff --git a/static.dockerfile b/static.dockerfile index 5b732486..36b2a15f 100644 --- a/static.dockerfile +++ b/static.dockerfile @@ -35,4 +35,4 @@ COPY --from=builder /usr/app/dist/ /usr/share/nginx/html/ COPY --from=builder /usr/app/dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY bin/entrypoint /bin -ENTRYPOINT entrypoint +ENTRYPOINT entrypoint \ No newline at end of file