From 144c001c1bda2f232b890aa4d9e22ff638a299b3 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 27 Mar 2026 06:14:40 +0100 Subject: [PATCH] Fix basic auth: use htpasswd instead of openssl passwd openssl passwd -apr1 produces inconsistent output in nginx:alpine. Switch to htpasswd from apache2-utils which is the standard tool. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 2 ++ docker-entrypoint.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9afa8c3..69f46ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ RUN npm run build # ── Stage 2: serve ────────────────────────────────────────────────────────── FROM nginx:alpine +RUN apk add --no-cache apache2-utils + # Copy built assets COPY --from=builder /app/dist /usr/share/nginx/html diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c07dafa..7ec97ec 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -7,7 +7,7 @@ if [ -z "$AUTH_USER" ] || [ -z "$AUTH_PASSWORD" ]; then exit 1 fi -echo "${AUTH_USER}:$(openssl passwd -apr1 "${AUTH_PASSWORD}")" > /etc/nginx/.htpasswd +htpasswd -bc /etc/nginx/.htpasswd "${AUTH_USER}" "${AUTH_PASSWORD}" # Hand off to the official nginx entrypoint (runs envsubst on *.template files) exec /docker-entrypoint.sh "$@"