From 81f80d88d7e1742f72e7c36fe093533c1e3b40b1 Mon Sep 17 00:00:00 2001 From: Is Isilon Date: Wed, 6 Jan 2016 17:58:46 +0800 Subject: [PATCH] Clean and spelling --- README.md | 11 ++++++----- build.sh | 2 +- docker-compose.yml | 9 +++++++++ docker-entrypoint.sh | 15 +++------------ 4 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index e1c1e33..78909ed 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,15 @@ Start using docker run -d --name devpi \ --publish 3141:3141 \ --volume /srv/docker/devpi:/data \ - --env=DEVPI_PASSWORD=changemetoyoulongsecret \ + --env=DEVPI_PASSWORD=changemetoyourlongsecret \ --restart always \ muccg/docker-devpi ``` -Please set DEVPI_PASSWORD to a secret otherwise an attacker can *execute arbitrary code* in your application by uploading modified packages. *Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml) file to start the container using [Docker Compose](https://docs.docker.com/compose/)* +Please set DEVPI_PASSWORD to a secret otherwise an attacker can *execute arbitrary code*. + ## Client side usage To use this devpi cache to speed up your dockerfile builds, add use the code below in your dockerfiles. This will add the devpi container an optional cache for pip. The docker containers will try using port 3141 on the docker host first and fall back on the normal pypi servers without breaking the build. @@ -56,11 +57,11 @@ pip wheel --download=packages --wheel-dir=wheelhouse -r requirements.txt pip install "devpi-client>=2.3.0" \ && export HOST_IP=$(ip route| awk '/^default/ {print $3}') \ && if devpi use http://$HOST_IP:3141>/dev/null; then \ - devpi use http://$HOST_IP:3141/${DEVPI_USER:-app}/${DEVPI_INDEX:-dev} --set-cfg \ - && devpi login ${DEVPI_USER:-app} --password=$DEVPI_PASSWORD \ + devpi use http://$HOST_IP:3141/root/public --set-cfg \ + && devpi login root --password=$DEVPI_PASSWORD \ && devpi upload --from-dir --formats=* ./wheelhouse ./packages; \ else \ - echo No started devpi container found at http://$HOST_IP:3141; \ + echo "No started devpi container found at http://$HOST_IP:3141"; \ fi ``` diff --git a/build.sh b/build.sh index 6a0f2ac..7c2a5b1 100755 --- a/build.sh +++ b/build.sh @@ -22,7 +22,7 @@ DEVPI_VERSION="2.5.3" image="${REPO}/devpi" echo "################################################################### ${image}" - + ## warm up cache for CI docker pull ${image} || true diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c75f65e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +devpi: + image: wassname/docker-devpi + volumes: + - /srv/docker/devpi:/data + ports: + - 3141:3141 + environment: + - DEVPI_PASSWORD= + restart: always diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f4210b3..6060285 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -12,21 +12,12 @@ function defaults { function initialise_devpi { echo "[RUN]: Initialise devpi-server" - chown -R ccg-user:ccg-user /data - devpi-server --restrict-modify root --start --host 127.0.0.1 --port 3141 devpi-server --status devpi use http://localhost:3141 - - # Check the root password has been changed - if devpi login root --password='' > /dev/null; then - devpi login root --password='' - devpi user -m root password="${DEVPI_PASSWORD}" - devpi index -y -c public pypi_whitelist='*' - else - echo root password already changed - fi - + devpi login root --password='' + devpi user -m root password="${DEVPI_PASSWORD}" + devpi index -y -c public pypi_whitelist='*' devpi-server --stop devpi-server --status }