This repository includes a Dockerfile that builds a lightweight Devpi server based upon Alpine Linux.
The current published image size is ~29MB and the virtual size is ~90MB.
This image configures the Devpi server directory as /var/lib/devpi.
If no existing data is detected in this directory, the Devpi server will be initialised with a root password provided via the DEVPI_ROOT_PASSWORD environment variable, or a 32 character random password if this environment variable is not defined.
You can also use the following initialization environment variables:
DEVPI_USER- adds a new user. If you restore from a Devpi backup, no action is taken if this user already existsDEVPI_PASSWORD- sets the password for the new user. If you restore from a Devpi backup and the user already exists, the user password is updated to the new passwordDEVPI_INDEX- creates an index for the user that is based from the defaultroot/pypiindex. The new index path will be$DEVPI_USER/$DEVPI_INDEX.
For example given the following settings:
DEVPI_USER= devDEVPI_PASSWORD= xyz123DEVPI_INDEX= root
The path to the index will be http://<server>:<port>/dev/root.
This image runs the following entrypoint:
devpi-server --serverdir /var/lib/devpi --restrict-modify root --host 0.0.0.0
You can add an array of additional flags as command arguments:
docker run -d --name devpi cloudhotspot/devpi <arg> [<arg> ...]
By default, Devpi listens on port 3141 and you must map this port if you do not supply a custom port configuration option:
docker run -d --name devpi -p 3141:3141 cloudhotspot/devpi
You can run Devpi on a custom port by setting the environment variable DEVPI_PORT option:
docker run -d --name devpi -p 8000:8000 -e DEVPI_PORT=8000 cloudhotspot/devpi
By default the devpi server will use /var/lib/devpi-server as its data directory.
You can override this my setting the DEVPI_SERVERDIR environment variable:
docker run -d --name devpi -e DEVPI_SERVERDIR=/mnt/devpi -e DEVPI_PORT=8000 -p 8000:8000 cloudhotspot/devpi
The entrypoint script looks in a directory called /devpi-init.d, extracts all *.bz2 files to a temporary folder and then attempts to import the contents of the extract files into devpi. This is useful if you have previously exported the state of a previous Devpi server.
NOTE: Importing a backup and initial indexing can take some time. Use the
docker logordocker-compose logcommand to watch the progress of Devpi initialization.
See the devpi-server administration docs for more details on exporting and importing server state.
This repository includes a sample docker-compose.yml file.
Note this sample assumes you have exported and compressed previous devpi server state to a file called backup.bz2 and have set an environment variable DEVPI_PASSWORD.
To use the Docker Compose file:
- Create an external docker volume called
devpi_databy runningdocker volume create --name devpi_data - Run
docker-compose up -d. Devpi will be running on port 8000. - Your Devpi data directory will be persisted to the
devpi_datavolume.
version: '2'
volumes:
devpi_data:
external: true
services:
devpi:
image: cloudhotspot/devpi
volumes:
- devpi_data:/var/lib/devpi
- ./backup.bz2:/devpi-init.d/backup.bz2
ports:
- "8000:8000"
stop_signal: SIGINT
environment:
DEVPI_USER: dev
DEVPI_PASSWORD: ${DEVPI_PASSWORD}
DEVPI_PORT: "8000"