Sign inSign up

devries/private_pypi

By devries

Updated about 6 years ago

Container that runs a private PyPI with basic authentication.

Image
0

124

devries/private_pypi repository overview

Private PyPI

This container runs a PyPI server on port 8080. A volume or bind mount should be attached to /data which contains two items:

  • A formatted htpasswd file with usernames and hashed passwords.
  • A directory called packages which will contain the packages.

If you have a directory called data in your current path with the above files and directories, you can run this package using the command:

docker run -d -v $PWD/data:/data -p 8080:8080 --name pypi devries/private_pypi:1.0

Saving Passwords

Passwords can be written to the htpasswd file using the htpasswd utility which is a utility available from Apache. The htpasswd utility is installed in the container, so you can run it with the command:

docker run --rm -ti -v $PWD:/data -w /data \
    -u $(id -u):$(id -g) devries/private_pypi:1.0 \
    htpasswd -cB htpasswd username

Remote Registry Setup

In the directions below replace "example" and "example.com" with your domain and the identifier you will use for you package index.

Add a repository to your poetry configuration using the command:

poetry config repositories.example https://pypi.example.com/

You can store your username and password for the repository using the command:

poetry config http-basic.example username password

You can now push a project to the private repository using the command:

poetry publish -r example

Pulling Libraries from Remote Repositories

Add the following stanza to your pyproject.toml:

[[tool.poetry.source]]
name = "example"
url = "https://pypi.example.com/simple/"
secondary = true

Now when searching for packages, both the regular PyPI will be searched as well as the example PyPI.

Tag summary

Content type

Image

Digest

Size

92.3 MB

Last updated

about 6 years ago

docker pull devries/private_pypi:1.0