See htpasswd on docker hub.
To generate a password file:
docker run --rm -ti dmmeteo/htpasswd <username> <password> > htpasswd
This will use bcrypt encryption.
To rebuild for all platforms:
docker buildx build \
--platform=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 \
-t dmmeteo/htpasswd:latest . --push