You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
741 B

  1. #!/usr/bin/env bash
  2. # fail if no hostname is provided
  3. REGISTRY_HOST=${REGISTRY_HOST:?no host}
  4. REGISTRY_PORT=${REGISTRY_PORT:-5000}
  5. # we are always listening on port 80
  6. # https://github.com/nginxinc/docker-nginx/blob/43c112100750cbd1e9f2160324c64988e7920ac9/stable/jessie/Dockerfile#L25
  7. PORT=80
  8. sed -e "s/%HOST%/$REGISTRY_HOST/g" \
  9. -e "s/%PORT%/$REGISTRY_PORT/g" \
  10. -e "s/%BIND_PORT%/$PORT/g" \
  11. </etc/nginx/conf.d/default.conf.in >/etc/nginx/conf.d/default.conf
  12. # wait for registry to come online
  13. while ! curl -sS "$REGISTRY_HOST:$REGISTRY_PORT" &>/dev/null; do
  14. printf "waiting for the registry (%s:%s) to come online...\n" "$REGISTRY_HOST" "$REGISTRY_PORT"
  15. sleep 1
  16. done
  17. printf "starting proxy...\n"
  18. exec nginx -g "daemon off;" "$@"