Dockerfile & doc updates

This commit is contained in:
Matthew Planchard 2018-06-26 20:51:32 -05:00
parent cd7707379a
commit 47231ea5fb
6 changed files with 93 additions and 18 deletions

View File

@ -35,3 +35,7 @@ __pycache__/
/.cache/
/.settings/
Dockerfile
venv
.venv
.vscode
.idea

View File

@ -12,4 +12,4 @@ AUTHORS
awk '{arr[$0]++} END{for (i in arr){print arr[i], i;}}' |
sort -rn | cut -d\ -f2-
to sort them by the numbers of commits.
to sort them by the numbers of commits.

View File

@ -1,15 +1,28 @@
Changelog
=========
Next Release
------------------
- MAINT: Remove broken downloads badge (thanks @hugovk, #209)
- ENH: Improved Dockerfile and ``docker-compose`` example, docs for using
the docker image, automatic docker builds
1.2.2 (2018-06-12)
------------------
- FIX: update fallback URL to https://pypi.org/simple since pypi.python.org
has shut down
- FIX: updated tests to use ``Popen`` rather than ``pip.main()`` given its
removal in pip version 10.0
- DOC: scrubbed docs of links to pypi.python.org
- DEPRECATION: Drop support for Python 3.3 (tahnks @hugovk, #198)
1.2.1 (2017-11-29)
------------------

View File

@ -1,17 +1,25 @@
FROM python:3.4
FROM python:3.6-alpine
# Build
COPY . /code
WORKDIR /code
RUN python setup.py install
RUN pip install passlib
WORKDIR /
RUN rm -rf /pypiserver
# Data Directory
RUN mkdir -p /data/packages
RUN adduser -S -u 9898 pypiserver && \
addgroup -S -g 9898 pypiserver && \
python setup.py install && \
pip install passlib && \
cd / && \
rm -rf /code && \
mkdir -p /data/packages && \
chown -R pypiserver:pypiserver /data/packages && \
# Set the setgid bit so anything added here gets associated with the
# pypiserver group
chmod g+s /data/packages
VOLUME /data/packages
USER pypiserver
WORKDIR /data
EXPOSE 8080
ENTRYPOINT ["pypi-server"]
CMD ["-p", "80", "packages"]
EXPOSE 80
ENTRYPOINT ["pypi-server", "-p", "8080"]
CMD ["packages"]

View File

@ -332,6 +332,45 @@ use it like this::
pypiupload requirements requirements.txt -i pypi_local
Using the Docker Image
======================
Starting with version 1.2.3, official Docker images are built for each
push to master, each dev, alpha, or beta release, and each final release.
The most recent full release will always be available under the tag ``latest``,
and the current master branch will always be available under the tag
``master``.
To run the most recent release of ``pypiserver`` with Docker, simply::
docker run pypiserver/pypiserver:latest
This starts ``pypiserver`` serving packages from the ``/data/packages``
directory inside the container, listening on the container port 8080.
The container takes all the same arguments as the normal ``pypi-server``
executable, with the exception of the internal container port (``-p``),
which will always be 8080.
Of course, just running a container isn't that interesting. To map
port 80 on the host to port 8080 on the container::
docker run -p 80:8080 pypiserver/pypiserver:latest
You can now access your ``pypiserver`` at ``localhost:80`` in a web browser.
To serve packages from a directory on the host, e.g. ``~/packages``::
docker run -p 80:8080 -v ~/packages:/data/packages pypiserver/pypiserver:latest
To authenticate against a local ``.htaccess`` file::
docker run -p 80:8080 -v ~/.htaccess:/data/.htaccess pypiserver/pypiserver:latest -P .htaccess packages
You can also specify ``pypiserver`` to run as a Docker service using a
composefile. An example composefile is `provided <docker-compose.yml>`_.
Alternative Installation methods
================================
When trying the methods below, first use the following command to check whether

View File

@ -1,7 +1,18 @@
pypiserver:
image: pypiserver
volumes:
- /var/pypiserver:/data
command: -p 80 -P /data/.htaccess -a update,download,list /data/packages
ports:
- "8080:80"
---
########################################################################
# pypiserver docker-compose example
########################################################################
version: "3"
services:
pypiserver:
image: pypiserver:latest
volumes:
# Mount local /tmp/pypiserver to /data in container
- /tmp/pypiserver:/data
# Use an .htaccess file to control access, serve packages from
# /tmp/pypiserver/packages (/data/packages in the container)
command: -P /data/.htaccess -a update,download,list /data/packages
ports:
- "80:8080"