Compare commits
16 Commits
20160411
...
9cbf6878fd
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cbf6878fd | |||
| 79cef474fd | |||
| 96f723f82b | |||
| 4729a2490e | |||
| edc907b857 | |||
| 645a3f9121 | |||
| d857782830 | |||
| abac966eca | |||
| f03fecaa5e | |||
| 18828fdc8e | |||
| d607b6ddc4 | |||
| 449d0f31a2 | |||
| 38a1da6c68 | |||
|
d84229454c
|
|||
| b1e8729290 | |||
| 79a90753c7 |
17
.drone.yml
Normal file
17
.drone.yml
Normal 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/\//-}
|
||||
|
||||
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,13 +1,21 @@
|
||||
FROM phusion/baseimage:0.9.18
|
||||
FROM phusion/baseimage:0.11
|
||||
|
||||
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
|
||||
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d
|
||||
# phusion baseimage says i'm not supposed to do this
|
||||
# and i don't care:
|
||||
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.run /etc/service/mirror/run
|
||||
@@ -22,6 +30,7 @@ RUN \
|
||||
mkdir -p $GNUPGHOME && \
|
||||
chmod go-rwx $GNUPGHOME && \
|
||||
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
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
# 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.
|
||||
|
||||
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.
|
||||
|
||||
# Levers
|
||||
@@ -19,6 +14,8 @@ Then even your builds (where you can't specify links) will go fast.
|
||||
* default `main,universe`.
|
||||
* You may want `main,universe,restricted,multiverse`. Will use lots of
|
||||
disk.
|
||||
* `UBUNTU_MIRROR_PROJECTS`
|
||||
* default `xenial,xenial-updates,xenial-security,xenial-backports,bionic,bionic-updates,bionic-security,bionic-backports`.
|
||||
* `UBUNTU_MIRROR_SOURCE`
|
||||
* default `archive.ubuntu.com`.
|
||||
* 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
|
||||
|
||||
```
|
||||
apt-get update && apt-get -y install dnsmasq
|
||||
cat > /etc/dnsmasq.d/docker <<EOF
|
||||
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
|
||||
apt update && apt -y install dnsmasq
|
||||
echo address=/mirrors.ubuntu.com/172.17.0.1 > /etc/dnsmasq.d/ubuntu-mirror-local
|
||||
```
|
||||
|
||||
Then, just add `--dns 172.17.0.1` to your /etc/default/docker opts
|
||||
|
||||
@@ -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
|
||||
@@ -14,15 +14,14 @@ export GNUPGHOME="/etc/debmirror/ubuntu"
|
||||
debmirror \
|
||||
-a ${MIRROR_ARCHITECTURES:-amd64} \
|
||||
--no-source \
|
||||
-s ${MIRROR_CATEGORIES:-main,universe} \
|
||||
-s ${MIRROR_CATEGORIES:-main,universe,multiverse,restricted} \
|
||||
-h ${UBUNTU_MIRROR_SOURCE:-archive.ubuntu.com} \
|
||||
-d trusty,trusty-updates,trusty-security,trusty-backports \
|
||||
-d xenial,xenial-updates,xenial-security,xenial-backports \
|
||||
-d ${UBUNTU_MIRROR_PROJECTS:-focal,focal-updates,focal-security,focal-backports} \
|
||||
--ignore-small-errors \
|
||||
-r /ubuntu \
|
||||
--getcontents \
|
||||
--progress \
|
||||
--method=http \
|
||||
$DST/ubuntu
|
||||
|
||||
|
||||
chmod -R a+rX $DST
|
||||
|
||||
11
sources.list
11
sources.list
@@ -1,4 +1,7 @@
|
||||
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main universe
|
||||
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main universe
|
||||
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main universe
|
||||
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main universe
|
||||
# this can't be {us.,}archive.ubuntu.org because on the box
|
||||
# with dnsmasq changing that host to itself, rebuilding this fails
|
||||
# unless the container is running already
|
||||
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
15
start-local-mirror.sh
Normal 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
|
||||
Reference in New Issue
Block a user