From 5d1214a9fa0913a551cb3d981ab9f5128c823f54 Mon Sep 17 00:00:00 2001 From: Is Isilon Date: Wed, 6 Jan 2016 16:07:49 +0800 Subject: [PATCH] Spelling and bugfixes --- Dockerfile | 2 +- README.md | 33 ++++++++++++++++++++------------- docker-entrypoint.sh | 6 ++++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index c737518..0f4dfcb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ENV DEVPI_VERSION $DEVPI_VERSION RUN NO_PROXY=$PIP_TRUSTED_HOST pip --trusted-host $PIP_TRUSTED_HOST install -i $PIP_INDEX_URL --upgrade \ "devpi-client>=2.3" "requests>=2.9.0" \ - "devpi-server==$DEVPI_VERSION" + "devpi-server==${DEVPI_VERSION:-2.5.3}" + "devpi-server==${DEVPI_VERSION:-2.5.3}" EXPOSE 3141 VOLUME /data diff --git a/README.md b/README.md index e297976..e1c1e33 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,17 @@ docker-devpi This repository contains a Dockerfile for [devpi pypi server](http://doc.devpi.net/latest/). -# Installation +You can use this container to speed up the `pip install` parts of your docker builds. This is done by adding an optional cache of your requirement python packages and speed up docker. The outcome is faster development without breaking builds. + +# Getting started + +## Installation `docker pull muccg/docker-devpi` -# Quickstart +## Quickstart -Start using +Start using ```bash docker run -d --name devpi \ @@ -21,20 +25,18 @@ docker run -d --name devpi \ ``` Please set DEVPI_PASSWORD to a secret otherwise an attacker can *execute arbitrary code* in your application by uploading modified packages. -# Persistence - -For devpi to preserve its state across container shutdown and startup you should mount a volume at `/data`. The quickstart command already includes this. +*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/)* -# Client side usage +## Client side usage -To use this devpi cache to speed up your dockerfile builds, add use this snippit in your dockerfiles. This will add the devpi container an optional cache for pip: +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. ```Dockerfile # Install netcat for ip route RUN apt-get update \ && apt-get install -y netcat \ && rm -rf /var/lib/apt/lists/* - + # Use an optional pip cache to speed development RUN export HOST_IP=$(ip route| awk '/^default/ {print $3}') \ && mkdir -p ~/.pip \ @@ -45,7 +47,9 @@ RUN export HOST_IP=$(ip route| awk '/^default/ {print $3}') \ && cat ~/.pip/pip.conf ``` -# Uploading files +## Uploading python packages files + +You need to upload your python requirement to get any benefit from the devpi container. You can upload them using the bash code below a similar build environment. ```bash pip wheel --download=packages --wheel-dir=wheelhouse -r requirements.txt @@ -60,9 +64,12 @@ else \ fi ``` -# Security +# Persistence -Devpi creates a user named root by default, its password can be set with DEVPI_PASSWORD environment variable. Please set it, otherwise attacker can *execute arbitrary code* in your application by uploading modified packages. +For devpi to preserve its state across container shutdown and startup you should mount a volume at `/data`. The quickstart command already includes this. + +# Security -For additonal security the argument `--restrict-modify root` has been added so only the root may create users and indexes. +Devpi creates a user named root by default, its password should be set with DEVPI_PASSWORD environment variable. Please set it, otherwise attackers can *execute arbitrary code* in your application by uploading modified packages. +For additional security the argument `--restrict-modify root` has been added so only the root may create users and indexes. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 10bc28f..f4210b3 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -12,10 +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='' @@ -24,7 +26,7 @@ function initialise_devpi { else echo root password already changed fi - + devpi-server --stop devpi-server --status }