├── Dockerfile ├── README.md └── run.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3 2 | RUN pip install "devpi-server>=2.5,<2.6dev" "devpi-client>=2.3,<=2.4dev" 3 | VOLUME /mnt 4 | EXPOSE 3141 5 | ADD run.sh / 6 | CMD ["/run.sh"] 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Devpi Dockerfile 2 | 3 | 4 | This repository contains **Dockerfile** of [Devpi](http://doc.devpi.net/) for [Docker](https://www.docker.io/)'s [trusted build](https://index.docker.io/u/scrapinghub/devpi/) published to the public [Docker Registry](https://index.docker.io/). 5 | 6 | 7 | ### Dependencies 8 | 9 | * [dockerfile/ubuntu](http://dockerfile.github.io/#/ubuntu) 10 | 11 | 12 | ### Installation 13 | 14 | 1. Install [Docker](https://www.docker.io/). 15 | 16 | 2. Download [trusted build](https://index.docker.io/u/scrapinghub/devpi/) from public [Docker Registry](https://index.docker.io/): `docker pull scrapinghub/devpi` 17 | 18 | (alternatively, you can build an image from Dockerfile: `docker build -t="scrapinghub/devpi" github.com/scrapinghub/docker-devpi`) 19 | 20 | 21 | ### Usage 22 | 23 | #### Run `devpi-server` 24 | 25 | docker run -d --name devpi -p 3141:3141 scrapinghub/devpi 26 | 27 | Devpi creates a user named `root` by default, its password can be set with 28 | `DEVPI_PASSWORD` environment variable. 29 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | export DEVPI_SERVERDIR=/mnt 5 | export DEVPI_CLIENTDIR=/tmp/devpi-client 6 | [[ -f $DEVPI_SERVERDIR/.serverversion ]] || initialize=yes 7 | 8 | kill_devpi() { 9 | test -n "$DEVPI_PID" && kill $DEVPI_PID 10 | } 11 | trap kill_devpi EXIT 12 | 13 | # For some reason, killing tail during EXIT trap function triggers an 14 | # "uninitialized stack frame" bug in glibc, so kill tail when handling INT or 15 | # TERM signal. 16 | kill_tail() { 17 | test -n "$TAIL_PID" && kill $TAIL_PID 18 | } 19 | trap kill_tail INT 20 | trap kill_tail TERM 21 | 22 | devpi-server --start --host 0.0.0.0 --port 3141 || \ 23 | { [ -f "$LOG_FILE" ] && cat "$LOG_FILE"; exit 1; } 24 | DEVPI_PID="$(cat $DEVPI_SERVERDIR/.xproc/devpi-server/xprocess.PID)" 25 | 26 | if [[ $initialize = yes ]]; then 27 | devpi use http://localhost:3141 28 | devpi login root --password='' 29 | devpi user -m root password="${DEVPI_PASSWORD}" 30 | devpi index -y -c public pypi_whitelist='*' 31 | fi 32 | # We cannot simply execute tail, because otherwise bash won't propagate 33 | # incoming TERM signals to tail and will hang indefinitely. Instead, we wait 34 | # on tail PID and then "wait" command will interrupt on TERM (or any other) 35 | # signal and the script will proceed to kill_* functions which will gracefully 36 | # terminate child processes. 37 | tail -f /etc/fstab & #"$LOG_FILE" & 38 | TAIL_PID=$! 39 | wait $TAIL_PID 40 | --------------------------------------------------------------------------------