Skip to content

Commit

Permalink
update docker-entrypoint for newer devpi
Browse files Browse the repository at this point in the history
  • Loading branch information
markmcclain committed Jan 8, 2024
1 parent 5928526 commit 46a1be5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@
function defaults {
: ${DEVPISERVER_SERVERDIR="/data/server"}
: ${DEVPI_CLIENTDIR="/data/client"}
: ${DEVPISERVER_SECRET="/data/devpi.secret"}

echo "DEVPISERVER_SERVERDIR is ${DEVPISERVER_SERVERDIR}"
echo "DEVPISERVER_SECRET is ${DEVPISERVER_SECRET}"
echo "DEVPI_CLIENTDIR is ${DEVPI_CLIENTDIR}"

export DEVPISERVER_SERVERDIR DEVPI_CLIENTDIR
export DEVPISERVER_SERVERDIR DEVPISERVER_SECRET DEVPI_CLIENTDIR
}

function initialize_devpi {
mkdir -p $DEVPISERVER_SERVERDIR
mkdir -p $DEVPI_CLIENTDIR
devpi-server --restrict-modify root --start --host 127.0.0.1 --port 3141 --init
devpi-server --status
devpi use http://localhost:3141
devpi login root --password=''
devpi user -m root password="${DEVPI_PASSWORD}"
devpi index -y -c public pypi_whitelist='*'
devpi-server --stop
devpi-server --status
devpi-init --role auto --root-passwd="${DEVPI_PASSWORD}" --serverdir $DEVPISERVER_SERVERDIR

}

defaults

if [ "$1" = 'devpi' ]; then
if [ ! -f $DEVPISERVER_SECRET ]; then
su-exec devpi devpi-gen-secret --secretfile $DEVPISERVER_SECRET
fi
if [ ! -f $DEVPISERVER_SERVERDIR/.serverversion ]; then
export -f initialize_devpi
su-exec devpi bash -c initialize_devpi
unset initialize_devpi
fi

exec su-exec devpi devpi-server --restrict-modify root --host 0.0.0.0 --port $DEVPI_PORT
exec su-exec devpi devpi-server --restrict-modify root --host 0.0.0.0 --port $DEVPI_PORT --secretfile $DEVPISERVER_SECRET
fi

exec "$@"

0 comments on commit 46a1be5

Please sign in to comment.