fix registry link
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
ENV_FILE="${ROOT_DIR}/.env.docker.production"
|
||||
COMPOSE_FILE="${ROOT_DIR}/docker-compose.registry.local.yml"
|
||||
AUTH_DIR="${ROOT_DIR}/docker/registry/auth"
|
||||
AUTH_FILE="${AUTH_DIR}/htpasswd"
|
||||
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
echo "Missing ${ENV_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -a
|
||||
source "${ENV_FILE}"
|
||||
set +a
|
||||
|
||||
mkdir -p "${AUTH_DIR}"
|
||||
|
||||
if [[ -n "${REGISTRY_USER:-}" && -n "${REGISTRY_PASSWORD:-}" ]]; then
|
||||
docker run --rm --entrypoint htpasswd httpd:2-alpine -Bbn "${REGISTRY_USER}" "${REGISTRY_PASSWORD}" > "${AUTH_FILE}"
|
||||
chmod 600 "${AUTH_FILE}"
|
||||
elif [[ ! -f "${AUTH_FILE}" ]]; then
|
||||
echo "Set REGISTRY_USER and REGISTRY_PASSWORD in ${ENV_FILE} or create ${AUTH_FILE} manually." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker compose -p rentaldrivego-registry-local --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" up -d
|
||||
|
||||
echo "Local registry is starting on port 5000."
|
||||
Reference in New Issue
Block a user