Proxy server intended for caching .rpm and .deb packages from a Linux repository mirror.
$ docker run \
--name="packages" \
--rm=true \
--volume=repository-package-cache:/var/cache/nginx:Z \
docker.io/aesiniath/proxy:latest
runs in foreground and logs when requests hit its cache. In this repo this command is conveniently contained in ./run.sh so:
$ ./run.sh
Change the repository configurations in your base image to point to the internal package mirror:
In /etc/yum.repos.d/ adjust fedora.repo to have:
baseurl=http://127.0.0.1:1999/fedora/linux/releases/$releasever/Everything/$basearch/os/
and in fedora-updates.repo to have:
baseurl=http://127.0.0.1:1999/fedora/linux/updates/$releasever/$basearch/
Adjust /etc/apt/sources.list to have:
deb http://127.0.0.1:1999/debian/ stretch main
deb http://127.0.0.1:1999/debian/ stretch-updates main
Build on a Fedora base image:
$ docker run -i -t --rm --network="proxy" localhost/afcowie/fedora:27 bash
ab317b9920d3 / # dnf install -y findutils
...
or building on a Debian base image:
$ docker run -i -t --rm docker.io/aesiniath/debian:stretch bash
d874ac8dd5d4 / # apt-get install findutils
...
Enjoy!
See TODO.
This container was set up based on incredibly helpful posts from:
- Michał Czeraszkiewicz, http://czerasz.com/2015/03/30/nginx-caching-tutorial/
- James Nzomo, http://tdt.rocks/repo_cache_ft_nginx.html