1
0
Fork 0
dri/entrypoint.sh

39 lines
874 B
Bash
Raw Normal View History

2018-09-26 23:04:26 +08:00
#!/bin/sh
BASE_URL=${BASE_URL:=/}
REGISTRY_HOST=${REGISTRY_HOST:=""}
REGISTRY_API=${REGISTRY_API:=""}
2018-09-29 15:39:45 +08:00
[[ "$DELETE_ENABLED" != "true" ]] && [[ "$DELETE_ENABLED" != "false" ]] && DELETE_ENABLED=false
2018-09-26 23:04:26 +08:00
REPOSITORIES_PER_PAGE=${REPOSITORIES_PER_PAGE:=0}
TAGS_PER_PAGE=${TAGS_PER_PAGE:=30}
[[ "$USE_PORTUS_EXPLORE" != "true" ]] && [[ "$USE_PORTUS_EXPLORE" != "false" ]] && USE_PORTUS_EXPLORE=false
2018-09-26 23:55:04 +08:00
sed -i "s~<base href=/ >~<base href=\"$BASE_URL\">~" /srv/index.html
2018-09-26 23:04:26 +08:00
cat > /etc/Caddyfile << EOF
:80$BASE_URL {
root /srv
browse
rewrite {
regexp (.*)
to {1} {1}/ /
}
}
EOF
cat > /srv/config.json << EOF
{
"registryHost": "$REGISTRY_HOST",
"registryAPI": "$REGISTRY_API",
2018-09-29 15:39:45 +08:00
"deleteEnabled": $DELETE_ENABLED,
2018-09-26 23:04:26 +08:00
"repositoriesPerPage": $REPOSITORIES_PER_PAGE,
"tagsPerPage": $TAGS_PER_PAGE,
"usePortusExplore": $USE_PORTUS_EXPLORE
}
EOF
"$@"