A docker image for caching git clone/pull based on jonasmalacofilho/git-cache-http-server, with
- git compression level turned to 9.
git gc --aggressiverun on every cached repository every night at 1:30 (can be overriden by environment variablesHOURandMIN, in 24 hour format).- After
WAIT_TIMEOUT(default to 4 hours, can be overloaded by environment variables), no newgit gc --aggressiveprocess will be spawned. In the next day, gc process will start from where it was left. - The
git gcprocess and the gc thread that account for monitoring and spawninggit gcprocess is limited by:- nice set to 19
- Using
SCHED_BATCHscheduler.
NOTE:
The time inside container maybe is different from your host due to different timezone.
Simply run docker pull nobodyxu/git-cache.
Just run make to build it.
Optionally, you can run the docker image from NobodyXu/apt-cache to enable apt-cache.
The image will automatically test whether port 8000 on your machine is open, so if you run something else on 8000 that is not a squid-deb-proxy, run env NO_APT_PROXY=true make.
After building the image, type make run to run the container, which also creates a volume for storing cache and publish a port on 8080.
To use the cache, simply run
git config --global url."http://$HOST_IP:$PORT_NUMBER/".insteadOf https://
in the container or on other machines.
If you have any problem using this repository or have advices on how to improve, please open a github issue and I will answer you as soon as possible.