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 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 06:14:40 +01:00
parent 29db643407
commit 144c001c1b
2 changed files with 3 additions and 1 deletions

View File

@@ -12,6 +12,8 @@ RUN npm run build
# ── Stage 2: serve ────────────────────────────────────────────────────────── # ── Stage 2: serve ──────────────────────────────────────────────────────────
FROM nginx:alpine FROM nginx:alpine
RUN apk add --no-cache apache2-utils
# Copy built assets # Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html

View File

@@ -7,7 +7,7 @@ if [ -z "$AUTH_USER" ] || [ -z "$AUTH_PASSWORD" ]; then
exit 1 exit 1
fi 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) # Hand off to the official nginx entrypoint (runs envsubst on *.template files)
exec /docker-entrypoint.sh "$@" exec /docker-entrypoint.sh "$@"