diff --git a/.dockerignore b/.dockerignore index ee5dc44..0434fd6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -35,3 +35,7 @@ __pycache__/ /.cache/ /.settings/ Dockerfile +venv +.venv +.vscode +.idea diff --git a/AUTHORS.rst b/AUTHORS.rst index d8811f6..8f5804b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -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. \ No newline at end of file + to sort them by the numbers of commits. diff --git a/CHANGES.rst b/CHANGES.rst index d21cc2c..08373d7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) ------------------ diff --git a/Dockerfile b/Dockerfile index d27b5ba..fda66ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.rst b/README.rst index de09ce6..0cba688 100644 --- a/README.rst +++ b/README.rst @@ -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 `_. + + Alternative Installation methods ================================ When trying the methods below, first use the following command to check whether diff --git a/docker-compose.yml b/docker-compose.yml index b723ee9..bd1b48b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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"