16 Commits

Author SHA1 Message Date
9cbf6878fd Update 'Dockerfile'
Some checks failed
continuous-integration/drone/push Build is failing
2020-02-15 17:45:58 +00:00
79cef474fd Update 'Dockerfile'
Some checks failed
continuous-integration/drone/push Build is failing
2020-02-15 17:44:46 +00:00
96f723f82b Update 'Dockerfile'
All checks were successful
continuous-integration/drone/push Build is passing
2020-02-15 17:44:17 +00:00
4729a2490e Update '.drone.yml'
All checks were successful
continuous-integration/drone/push Build is passing
2020-02-15 17:39:38 +00:00
edc907b857 make mirror directory a docker volume
Some checks failed
continuous-integration/drone/push Build is failing
2020-02-08 05:30:08 -08:00
645a3f9121 prepping for release in caprover
Some checks failed
continuous-integration/drone/push Build is failing
2020-02-08 05:29:08 -08:00
d857782830 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2020-02-08 05:13:06 +00:00
abac966eca Add '.drone.yml' 2020-02-08 05:01:23 +00:00
f03fecaa5e add local mirror startup script 2019-03-20 17:39:38 -07:00
18828fdc8e updates 2019-01-25 06:10:37 +00:00
d607b6ddc4 add --getcontents debmirror for apt-file 2019-01-25 05:58:11 +00:00
449d0f31a2 Merge branch 'master' of github.com:sneak/docker-ubuntumirror 2019-01-25 03:12:31 +00:00
38a1da6c68 update xenial->bionic, add restricted and multiverse 2019-01-25 11:50:51 +09:00
d84229454c update for bionic 2018-10-01 15:02:57 -07:00
b1e8729290 updated to xenial for fixed debmirror for translations
see https://bugs.launchpad.net/ubuntu/+source/debmirror/+bug/1565585
2016-09-12 11:14:06 +02:00
79a90753c7 now supports specifying projects via env vars 2016-09-01 03:38:03 +02:00
7 changed files with 59 additions and 40 deletions

17
.drone.yml Normal file
View File

@@ -0,0 +1,17 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
repo: sneak/ubuntumirror
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- ${DRONE_COMMIT_SHA}
- ${DRONE_BRANCH/\//-}

View File

@@ -1,13 +1,21 @@
FROM phusion/baseimage:0.9.18 FROM phusion/baseimage:0.11
VOLUME /var/mirror VOLUME /var/mirror
ENV MIRROR_ARCHITECTURES amd64
ENV SOURCE_MIRROR
ENV MIRROR_CATEGORIES main,universe,restricted,multiverse
ENV UBUNTU_MIRROR_SOURCE archive.ubuntu.com
ENV UBUNTU_MIRROR_PROJECTS bionic,bionic-updates,bionic-security,bionic-backports,focal,focal-updates,focal-security,focal-backports
ENV THIS_MIRROR_URL http://172.17.0.1/ubuntu/
ADD ./sources.list /etc/apt/sources.list ADD ./sources.list /etc/apt/sources.list
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d
# phusion baseimage says i'm not supposed to do this # phusion baseimage says i'm not supposed to do this
# and i don't care: # and i don't care:
RUN apt-get update && apt-get upgrade -y RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y run-one nginx make debmirror RUN apt-get install -y run-one nginx make debmirror xz-utils
ADD ./mirror /opt/mirror ADD ./mirror /opt/mirror
ADD ./mirror.run /etc/service/mirror/run ADD ./mirror.run /etc/service/mirror/run
@@ -22,6 +30,7 @@ RUN \
mkdir -p $GNUPGHOME && \ mkdir -p $GNUPGHOME && \
chmod go-rwx $GNUPGHOME && \ chmod go-rwx $GNUPGHOME && \
gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg && \ gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg && \
cp $GNUPGHOME/pubring.gpg $GNUPGHOME/trustedkeys.gpg cp $GNUPGHOME/pubring.kbx $GNUPGHOME/trustedkeys.kbx
EXPOSE 80 EXPOSE 80

View File

@@ -1,13 +1,8 @@
# sneak/ubuntumirror # sneak/ubuntumirror
Docker container for syncing trusty and xenial ubuntu LTS mirrors Docker container for syncing bionic ubuntu LTS mirrors
to reduce network traffic and speed up build times. to reduce network traffic and speed up build times.
I recommend deploying this with a `--dns 172.17.0.1` in your
`/etc/default/docker` and dnsmasq bound to 172.17.0.1:53 to rewrite
`archive.ubuntu.com` to `172.17.0.1` (which this image will be listening and
serving on).
Then even your builds (where you can't specify links) will go fast. Then even your builds (where you can't specify links) will go fast.
# Levers # Levers
@@ -19,6 +14,8 @@ Then even your builds (where you can't specify links) will go fast.
* default `main,universe`. * default `main,universe`.
* You may want `main,universe,restricted,multiverse`. Will use lots of * You may want `main,universe,restricted,multiverse`. Will use lots of
disk. disk.
* `UBUNTU_MIRROR_PROJECTS`
* default `xenial,xenial-updates,xenial-security,xenial-backports,bionic,bionic-updates,bionic-security,bionic-backports`.
* `UBUNTU_MIRROR_SOURCE` * `UBUNTU_MIRROR_SOURCE`
* default `archive.ubuntu.com`. * default `archive.ubuntu.com`.
* You may want `xx.archive.ubuntu.com` (where `xx` is your country * You may want `xx.archive.ubuntu.com` (where `xx` is your country
@@ -30,14 +27,8 @@ Then even your builds (where you can't specify links) will go fast.
# Example dnsmasq setup # Example dnsmasq setup
``` ```
apt-get update && apt-get -y install dnsmasq apt update && apt -y install dnsmasq
cat > /etc/dnsmasq.d/docker <<EOF echo address=/mirrors.ubuntu.com/172.17.0.1 > /etc/dnsmasq.d/ubuntu-mirror-local
no-resolv
server=8.8.8.8
server=8.8.4.4
EOF
echo "172.17.0.1 archive.ubuntu.com" >> /etc/hosts
service dnsmasq restart
``` ```
Then, just add `--dns 172.17.0.1` to your /etc/default/docker opts Then, just add `--dns 172.17.0.1` to your /etc/default/docker opts

View File

@@ -1,15 +0,0 @@
version: '2.0'
services:
mirror:
hostname: mirror
image: sneak/ubuntumirror
build: .
network_mode: bridge
volumes:
- "/mnt/scratch/mirror:/var/mirror"
ports:
- "172.17.0.1:80:80"
environment:
- UBUNTU_MIRROR_SOURCE=de.archive.ubuntu.com
- MIRROR_CATEGORIES=main,universe,restricted

View File

@@ -14,15 +14,14 @@ export GNUPGHOME="/etc/debmirror/ubuntu"
debmirror \ debmirror \
-a ${MIRROR_ARCHITECTURES:-amd64} \ -a ${MIRROR_ARCHITECTURES:-amd64} \
--no-source \ --no-source \
-s ${MIRROR_CATEGORIES:-main,universe} \ -s ${MIRROR_CATEGORIES:-main,universe,multiverse,restricted} \
-h ${UBUNTU_MIRROR_SOURCE:-archive.ubuntu.com} \ -h ${UBUNTU_MIRROR_SOURCE:-archive.ubuntu.com} \
-d trusty,trusty-updates,trusty-security,trusty-backports \ -d ${UBUNTU_MIRROR_PROJECTS:-focal,focal-updates,focal-security,focal-backports} \
-d xenial,xenial-updates,xenial-security,xenial-backports \
--ignore-small-errors \ --ignore-small-errors \
-r /ubuntu \ -r /ubuntu \
--getcontents \
--progress \ --progress \
--method=http \ --method=http \
$DST/ubuntu $DST/ubuntu
chmod -R a+rX $DST chmod -R a+rX $DST

View File

@@ -1,4 +1,7 @@
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main universe # this can't be {us.,}archive.ubuntu.org because on the box
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main universe # with dnsmasq changing that host to itself, rebuilding this fails
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main universe # unless the container is running already
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main universe deb http://mirrors.sonic.net/ubuntu bionic main universe
deb http://mirrors.sonic.net/ubuntu bionic-updates main universe
deb http://mirrors.sonic.net/ubuntu bionic-backports main universe
deb http://mirrors.sonic.net/ubuntu bionic-security main universe

15
start-local-mirror.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
docker rm -f local-ubuntu-mirror
docker run -d --name local-ubuntu-mirror \
-v /storage/mirrors/ubuntu/ubuntu:/var/mirror/ubuntu \
--env UBUNTU_MIRROR_SOURCE=archive.ubuntu.com \
--env MIRROR_INTERVAL_SECONDS=10800 \
--env MIRROR_CATEGORIES=main,universe,restricted,multiverse \
--env MIRROR_ARCHITECTURES=amd64 \
--env UBUNTU_MIRROR_PROJECTS=bionic,bionic-updates,bionic-security,bionic-backports,focal,focal-updates,focal-security,focal-backports \
--dns 8.8.8.8 \
--dns 8.8.4.4 \
-p 172.17.0.1:80:80 \
--restart unless-stopped \
sneak/ubuntumirror:latest