#!/bin/sh

set -e

/usr/bin/harbor-install-cert.sh
# The /var/lib/docker-registry volume is shared between the harbor-registry and the
# harbor-registryctl containers, which run with different users. Relaxing the umask
# and adding the harbor user to the registry group allows other users in the registry
# group to modify the shared volume. This is required because registryctl invokes
# docker-registry to run garbage collection and needs write access to the image store volume.
usermod -G registry harbor
chmod -R g+w /var/lib/docker-registry
umask 0002
exec /usr/bin/gosu harbor /usr/bin/harbor-registryctl -c /etc/registryctl/config.yml
