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>
14 lines
376 B
Bash
14 lines
376 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Generate .htpasswd from environment variables
|
|
if [ -z "$AUTH_USER" ] || [ -z "$AUTH_PASSWORD" ]; then
|
|
echo "ERROR: AUTH_USER and AUTH_PASSWORD must be set" >&2
|
|
exit 1
|
|
fi
|
|
|
|
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 "$@"
|