https://github.com/nobodyxu/git-cache
A docker image for caching git clone/pull with highest git compression level and nightly git gc based on jonasmalacofilho/git-cache-http-server (github).
https://github.com/nobodyxu/git-cache
debian-buster docker docker-cloud docker-image git git-cache nightly-gc server
Last synced: 9 months ago
JSON representation
A docker image for caching git clone/pull with highest git compression level and nightly git gc based on jonasmalacofilho/git-cache-http-server (github).
- Host: GitHub
- URL: https://github.com/nobodyxu/git-cache
- Owner: NobodyXu
- License: mit
- Created: 2019-07-23T16:30:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T00:18:16.000Z (over 6 years ago)
- Last Synced: 2025-03-25T02:17:39.080Z (9 months ago)
- Topics: debian-buster, docker, docker-cloud, docker-image, git, git-cache, nightly-gc, server
- Language: Shell
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-cache



A docker image for caching git clone/pull based on [jonasmalacofilho/git-cache-http-server][1], with
1. git compression level turned to 9.
2. `git gc --aggressive` run on every cached repository every night at 1:30 (can be overriden by environment variables `HOUR` and `MIN`, in 24 hour format).
3. After `WAIT_TIMEOUT` (default to 4 hours, can be overloaded by environment variables), no new `git gc --aggressive` process will be spawned. In the next day, gc process will start from where it was left.
4. The `git gc` process and the gc thread that account for monitoring and spawning `git gc` process is limited by:
- nice set to 19
- Using `SCHED_BATCH` scheduler.
*NOTE*:
The time inside container maybe is *different* from your host due to different timezone.
# Usage
## Pull from docker hub
Simply run `docker pull nobodyxu/git-cache`.
## How to build
Just run `make` to build it.
Optionally, you can run the docker image from [NobodyXu/apt-cache][2] to enable apt-cache.
### *NOTE*
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`.
## How to run
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.
## How to use
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.
# Reference:
1. [jonasmalacofilho/git-cache-http-server][1]
[1]: https://github.com/jonasmalacofilho/git-cache-http-server
[2]: https://github.com/NobodyXu/apt-cache