A Dockerfile image based on python:3-alpine3.9 that runs a devpi server (a PyPi Cache).
To install required packages, and to store required package cache on devpi server's index_url (in order to use packages in offline air-gapped environment) :
- Update
requirements.txt
file with the list of required package dependencies before image build. These listed packages inrequirements.txt
will be installed as a part of image build.
After clonning repository, change current directory to devpi folder :
cd devpi
Build an image using Dockerfile present in current working directory
podman build -t <image_name> .
Alternatively you can specify Python base image, used as environment detected by pip to pull dependencies for, by providing build parameter PYTHON_IMAGE
.
podman build -t <image_name> --build-arg PYTHON_IMAGE=pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime .
Run container instance using image created above by port forwarding container port 3141
to container host's port 3141
podman run -it --rm -p 3141:3141 --name devpi localhost/<image_name>
Use a configuration similar to this in your ~/.pip/pip.conf
:
[global]
index-url = http://<devpi_server_url>/root/pypi/+simple/
Use a configuration similar to this in your ~/.pydistutils.cfg
:
[easy_install]
index_url = http://<devpi_server_url>/root/pypi/+simple/
In case, to run devpi-server on localhost system : <devpi_server_url>
~ localhost