Python PIP Cache
Download python pip packages from pypi.org can be slow especially for large packages like Pandas, PyTorch, etc. It helps to have a local pip mirror to speed up package downloads.
This docker container uses EpicWink/proxpi container to setup a local pip cache. To use it, run
# If deployed without HTTPS
pip install --index-url="http://10.10.10.10:5000/index/" --trusted-host 10.10.10.10 numpy pandas
pip install --index-url="http://10.10.10.10:5000/index/" --trusted-host 10.10.10.10 -r requriements.txt
# If deployed with HTTPS and a valid certificate
pip install --index-url=https://pip.bitsathy.ac.in/index/ numpy
pip install --index-url=https://pip.bitsathy.ac.in/index/ -r requirements.txtProxyPi docker-compose without Traefik
# Python PIP cache
# For use with python-docker
#
# eg usage: pip install --index-url=http://100.88.68.37:5000/index/ --trusted-host 100.88.68.37 numpy
version: "2.4"
name: proxypi
services:
proxypi:
image: epicwink/proxpi
container_name: proxpi
restart: always
mem_limit: 4G
environment:
- PROXPI_CACHE_DIR=/data
# 50GB in bytes
- PROXPI_CACHE_SIZE=50000000000
ports:
- 5000:5000
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
labels:
- com.centurylinklabs.watchtower.enable=trueProxyPi docker-compose with Traefik
# Python PIP cache
# For use with python-docker
#
# eg usage: pip install --index-url=https://pip.bitsathy.ac.in/index/ numpy
version: "2.4"
name: pip.bitsathy.ac.in
services:
pip:
image: epicwink/proxpi
container_name: pip.bitsathy.ac.in
restart: always
mem_limit: 4G
environment:
- PROXPI_CACHE_DIR=/data
# 50GB in bytes
- PROXPI_CACHE_SIZE=50000000000
expose:
- 5000
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
labels:
- com.centurylinklabs.watchtower.enable=true
- traefik.enable=true
- traefik.http.routers.pip.rule=Host(`pip.bitsathy.ac.in`)
- traefik.http.routers.pip.tls=true
- traefik.http.routers.pip.tls.certresolver=lets-encrypt
- traefik.http.routers.pip.service=pip
- traefik.http.services.pip.loadbalancer.server.port=5000
- traefik.http.routers.pip.middlewares=pipprivateonly
- traefik.http.middlewares.pipprivateonly.ipwhitelist.sourcerange=127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16
- traefik.http.middlewares.pipprivateonly.ipwhitelist.ipstrategy.depth=0References
- See also apt-cacher.