You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.9 KiB

11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. docker-devpi
  2. ============
  3. This repository contains a Dockerfile for [devpi pypi server](http://doc.devpi.net/latest/).
  4. You can use this container to speed up the `pip install` parts of your docker
  5. builds. This is done by adding an optional cache of your requirement python
  6. packages and speed up docker. The outcome is faster development without
  7. breaking builds.
  8. # Getting started
  9. ## Installation
  10. `docker pull muccg/devpi`
  11. ## Quickstart
  12. Start using
  13. ```bash
  14. docker run -d --name devpi \
  15. --publish 3141:3141 \
  16. --volume /srv/docker/devpi:/data \
  17. --env=DEVPI_PASSWORD=changemetoyourlongsecret \
  18. --restart always \
  19. muccg/devpi
  20. ```
  21. *Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml)
  22. file to start the container using [Docker
  23. Compose](https://docs.docker.com/compose/)*
  24. Please set ``DEVPI_PASSWORD`` to a secret otherwise an attacker can *execute
  25. arbitrary code*.
  26. ## Client side usage
  27. To use this devpi cache to speed up your dockerfile builds, add the code below
  28. in your dockerfiles. This will add the devpi container an optional cache for
  29. pip. The docker containers will try using port 3141 on the docker host first
  30. and fall back on the normal pypi servers without breaking the build.
  31. ```Dockerfile
  32. # Install netcat for ip route
  33. RUN apt-get update \
  34. && apt-get install -y netcat \
  35. && rm -rf /var/lib/apt/lists/*
  36. # Use an optional pip cache to speed development
  37. RUN export HOST_IP=$(ip route| awk '/^default/ {print $3}') \
  38. && mkdir -p ~/.pip \
  39. && echo [global] >> ~/.pip/pip.conf \
  40. && echo extra-index-url = http://$HOST_IP:3141/app/dev/+simple >> ~/.pip/pip.conf \
  41. && echo [install] >> ~/.pip/pip.conf \
  42. && echo trusted-host = $HOST_IP >> ~/.pip/pip.conf \
  43. && cat ~/.pip/pip.conf
  44. ```
  45. ## Uploading python packages files
  46. You need to upload your python requirement to get any benefit from the devpi
  47. container. You can upload them using the bash code below a similar build
  48. environment.
  49. ```bash
  50. pip wheel --download=packages --wheel-dir=wheelhouse -r requirements.txt
  51. pip install "devpi-client>=2.3.0" \
  52. && export HOST_IP=$(ip route| awk '/^default/ {print $3}') \
  53. && if devpi use http://$HOST_IP:3141>/dev/null; then \
  54. devpi use http://$HOST_IP:3141/root/public --set-cfg \
  55. && devpi login root --password=$DEVPI_PASSWORD \
  56. && devpi upload --from-dir --formats=* ./wheelhouse ./packages; \
  57. else \
  58. echo "No started devpi container found at http://$HOST_IP:3141"; \
  59. fi
  60. ```
  61. # Persistence
  62. For devpi to preserve its state across container shutdown and startup you
  63. should mount a volume at `/data`. The quickstart command already includes this.
  64. # Security
  65. Devpi creates a user named root by default, its password should be set with
  66. ``DEVPI_PASSWORD`` environment variable. Please set it, otherwise attackers can
  67. *execute arbitrary code* in your application by uploading modified packages.
  68. For additional security the argument `--restrict-modify root` has been added so
  69. only the root may create users and indexes.