diff --git a/Dockerfile b/Dockerfile index 0d07ffd..22148e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM phusion/baseimage:0.11 VOLUME /var/mirror +ENV MIRROR_INTERVAL_SECONDS 43200 ENV MIRROR_ARCHITECTURES amd64 ENV UBUNTU_SOURCE_MIRROR ENV MIRROR_CATEGORIES main,universe,restricted,multiverse diff --git a/README.markdown b/README.markdown index 4c43968..e190b0f 100644 --- a/README.markdown +++ b/README.markdown @@ -1,36 +1,41 @@ # sneak/ubuntumirror -Docker container for syncing bionic ubuntu LTS mirrors -to reduce network traffic and speed up build times. +Docker image for syncing ubuntu LTS mirrors to reduce network traffic and +speed up build times. -Then even your builds (where you can't specify links) will go fast. +Then even your builds (where you can't specify links to other containers by +hostname) will go fast. # Levers +## Environment Variables + * `MIRROR_ARCHITECTURES` - * default `amd64`. + * default `amd64`. * You may want `i386,amd64`. * `MIRROR_CATEGORIES` - * default `main,universe`. - * You may want `main,universe,restricted,multiverse`. Will use lots of - disk. + * Default `main,universe,restricted,multiverse`. Will use lots of disk. + * You may want `main,universe`. * `UBUNTU_MIRROR_PROJECTS` - * default `xenial,xenial-updates,xenial-security,xenial-backports,bionic,bionic-updates,bionic-security,bionic-backports`. -* `UBUNTU_MIRROR_SOURCE` + * Default + `bionic,bionic-updates,bionic-security,bionic-backports,focal,focal-updates,focal-security,focal-backports`. + * You may want only `focal,focal-updates,focal-security,focal-backports`. +* `UBUNTU_MIRROR_SOURCE` - upstream server to mirror from * default `archive.ubuntu.com`. * You may want `xx.archive.ubuntu.com` (where `xx` is your country code). -* `MIRROR_INTERVAL_SECONDS` - mirror sync interval +* `UBUNTU_SOURCE_MIRROR` - do we want to mirror all the source code too? + * Default `` + * You may want `1` if you want to use up even more disk for your mirror +* `MIRROR_INTERVAL_SECONDS` - mirror update interval * default `43200` (12h) * You may want `10800` (3h) -# Example dnsmasq setup +# Example CapRover Definition File ``` -apt update && apt -y install dnsmasq -echo address=/mirrors.ubuntu.com/172.17.0.1 > /etc/dnsmasq.d/ubuntu-mirror-local + { + "schemaVersion": 2, + "imageName": "sneak/ubuntumirror:latest" +} ``` - -Then, just add `--dns 172.17.0.1` to your /etc/default/docker opts -and bounce the docker daemon. Future containers will talk to your local -mirror. diff --git a/mirror.run b/mirror.run index 4a691b5..c0adc3a 100644 --- a/mirror.run +++ b/mirror.run @@ -6,8 +6,8 @@ export HOME=/root # cleanup previous runs rm -rf /var/mirror/ubuntu/.temp -while true ; do +while sleep 1 ; do cd /opt/mirror && make - sleep ${MIRROR_INTERVAL_SECONDS:-43200} + sleep ${MIRROR_INTERVAL_SECONDS} done