├── .gitignore ├── Dockerfile ├── README.md └── htaccess /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | ### vim ### 4 | [._]*.s[a-w][a-z] 5 | [._]s[a-w][a-z] 6 | *.un~ 7 | Session.vim 8 | .netrwhist 9 | *~ 10 | 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:wheezy 2 | MAINTAINER Jean-Christophe Saad-Dupuy 3 | 4 | ENV DEBIAN_FRONTEND noninteractive 5 | 6 | ########################## 7 | # system update 8 | ########################## 9 | RUN apt-get update -qq 10 | RUN apt-get upgrade -qq -y 11 | ########################## 12 | 13 | ########################## 14 | # python stuffs installation 15 | RUN apt-get install -qq -y python2.7 python-pip 16 | ########################## 17 | 18 | ########################## 19 | # pypiserver installation 20 | ########################## 21 | RUN pip install pypiserver 22 | RUN pip install passlib 23 | ########################## 24 | 25 | 26 | ########################## 27 | RUN useradd -d /home/pypiserver -m pypiserver 28 | ########################## 29 | 30 | ########################## 31 | # create the /data folder and symlink to the default folder 32 | ########################## 33 | RUN mkdir -p /data/packages 34 | RUN chown -R pypiserver /data/packages 35 | RUN ln -s /data/packages /home/pypiserver/packages 36 | RUN chown -R pypiserver /home/pypiserver/packages 37 | ########################## 38 | 39 | ########################## 40 | # create the /config folder and symlink to the default folder 41 | ########################## 42 | RUN mkdir -p /config 43 | RUN chown -R pypiserver /data/packages 44 | ########################## 45 | 46 | VOLUME ["/data/packages", "/config"] 47 | 48 | ########################## 49 | # exposes the default port 50 | ########################## 51 | EXPOSE 8080 52 | ########################## 53 | 54 | # Fix empty $HOME 55 | ENV HOME /home/pypiserver 56 | USER pypiserver 57 | 58 | ADD htaccess /config/.htaccess 59 | 60 | WORKDIR /home/pypiserver 61 | 62 | # Always starts with the .htaccess 63 | ENTRYPOINT ["/usr/local/bin/pypi-server", "-P", "/config/.htaccess"] 64 | 65 | # Hack : add a CMD with default value to enable passing other options 66 | CMD ["-p", "8080"] 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | docker-pypiserver 2 | ================= 3 | 4 | pypiserver in a box 5 | 6 | 7 | *with additions from Fred Thiele * 8 | 9 | 10 | # Quick start 11 | 12 | ## Launch the server 13 | 14 | mkdir -p /tmp/pypi/packages 15 | docker run -p 8080:8080 -v /tmp/pypi/packages:/data/packages jcsaaddupuy/pypiserver 16 | 17 | ## Default config 18 | 19 | The image comes with a default account : 20 | 21 | - login : admin 22 | - password : password 23 | 24 | ## Configure setup tools 25 | 26 | In ~/.pypirc, add the following content : 27 | 28 | [distutils] 29 | index-servers = 30 | internal 31 | 32 | [internal] 33 | repository: http://127.0.0.1:8080 34 | username: admin 35 | password: password 36 | 37 | ## Upload your first package 38 | 39 | ``` 40 | python setup.py sdist upload -r internal 41 | ``` 42 | 43 | You can now browse to [http://localhost:8080/simple](http://localhost:8080/simple) 44 | to browse availables packages 45 | 46 | 47 | 48 | # Advanced usage 49 | 50 | The image starts with pypi-server as main entry point, configured to use the 51 | .htaccess (see Dockerfile for details). You can pass any pypi-server option when 52 | running the container. 53 | 54 | See [schmir/pypiserver](https://github.com/schmir/pypiserver) for all availables 55 | options. 56 | 57 | ## Enable package overwriting 58 | 59 | Simply pass the _-o_ option : 60 | 61 | docker run -p 8080:8080 -v /tmp/pypi/packages:/data/packages jcsaaddupuy/pypiserver -o 62 | 63 | 64 | ## Use custom accounts 65 | First, generate a custom .htaccess file : 66 | 67 | htpasswd -sc /path/to/config/.htaccess account_name 68 | 69 | Then, start the container with the folder containing the config mounted as 70 | /home/pypiserver/config : 71 | 72 | docker run -p 8080:8080 -v /tmp/pypi/packages:/data/packages -v /path/to/config:/config jcsaaddupuy/pypiserver 73 | 74 | ## Use with tox 75 | 76 | in tox.ini, add your server in the __indexserver__ section : 77 | 78 | [tox] 79 | indexserver = 80 | default = https://pypi.python.org/simple 81 | DEV = http://127.0.0.1:8080/simple 82 | 83 | You can then use your own server pypi server to install dependancies, by 84 | prefixing the modulename with the alias given in indexserver (in our case, :DEV:) : 85 | 86 | [testenv] 87 | deps= :DEV:your_awesome_module 88 | 89 | 90 | -------------------------------------------------------------------------------- /htaccess: -------------------------------------------------------------------------------- 1 | admin:{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g= 2 | --------------------------------------------------------------------------------