Compare commits
11 Commits
20190320
...
3e27d9bf26
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e27d9bf26 | |||
| 866b8f4dfd | |||
| 7083e9c0f1 | |||
| 9cbf6878fd | |||
| 79cef474fd | |||
| 96f723f82b | |||
| 4729a2490e | |||
| edc907b857 | |||
| 645a3f9121 | |||
| d857782830 | |||
| abac966eca |
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/\//-}
|
||||
|
||||
|
||||
25
Dockerfile
25
Dockerfile
@@ -2,6 +2,30 @@ FROM phusion/baseimage:0.11
|
||||
|
||||
VOLUME /var/mirror
|
||||
|
||||
ENV MIRROR_ARCHITECTURES amd64
|
||||
ENV UBUNTU_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
|
||||
|
||||
# The following is the URL populated in /mirrors.txt as used by mirror://
|
||||
# protocol scheme in sources.list
|
||||
# the idea is that you can DNS rewrite 'mirrors.ubuntu.com' to this mirror
|
||||
# and it will return a "list" of mirrors that includes only itself.
|
||||
# then you can safely use something like the following in your sources.list
|
||||
# and it will work with max speed on your own dns-rewritten lan and in the
|
||||
# unmodified datacenter talking to the real mirrors.ubuntu.com:
|
||||
#
|
||||
# MURM="main universe restricted multiverse"
|
||||
# C="$(lsb_release -cs)"
|
||||
# M="mirror://mirrors.ubuntu.com/mirrors.txt"
|
||||
# echo "deb $M $C $MURM" > /etc/apt/sources.list.new
|
||||
# echo "deb $M $C-updates $MURM" >> /etc/apt/sources.list.new
|
||||
# echo "deb $M $C-backports $MURM" >> /etc/apt/sources.list.new
|
||||
# echo "deb $M $C-security $MURM" >> /etc/apt/sources.list.new
|
||||
# mv /etc/apt/sources.list.new /etc/apt/sources.list
|
||||
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
|
||||
@@ -24,4 +48,5 @@ RUN \
|
||||
gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg && \
|
||||
cp $GNUPGHOME/pubring.kbx $GNUPGHOME/trustedkeys.kbx
|
||||
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
12
bin/start-local-mirror.sh
Normal file
12
bin/start-local-mirror.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker rm -f local-ubuntu-mirror
|
||||
docker run -d --name local-ubuntu-mirror \
|
||||
-v /storage/mirrors/ubuntu:/var/mirror/ubuntu \
|
||||
--env MIRROR_INTERVAL_SECONDS=10800 \
|
||||
--env MIRROR_ARCHITECTURES=amd64 \
|
||||
--dns 8.8.8.8 \
|
||||
--dns 8.8.4.4 \
|
||||
-p 8080:80 \
|
||||
--restart unless-stopped \
|
||||
sneak/ubuntumirror:latest
|
||||
@@ -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
|
||||
@@ -4,19 +4,24 @@ set -x
|
||||
THISDIR="$(cd $(dirname "$BASH_SOURCE") && pwd -P)"
|
||||
DST="/var/mirror"
|
||||
|
||||
echo "http://172.17.0.1/ubuntu/" > $DST/mirrors.txt
|
||||
echo "$THIS_MIRROR_URL" > $DST/mirrors.txt
|
||||
chmod a+r $DST/mirrors.txt
|
||||
|
||||
mkdir -p "$DST/ubuntu"
|
||||
|
||||
export GNUPGHOME="/etc/debmirror/ubuntu"
|
||||
|
||||
SOURCEOPT="--nosource"
|
||||
if [[ ! -z "$UBUNTU_SOURCE_MIRROR" ]]; then
|
||||
SOURCEOPT="--source"
|
||||
fi
|
||||
|
||||
debmirror \
|
||||
-a ${MIRROR_ARCHITECTURES:-amd64} \
|
||||
--no-source \
|
||||
-s ${MIRROR_CATEGORIES:-main,universe} \
|
||||
-h ${UBUNTU_MIRROR_SOURCE:-archive.ubuntu.com} \
|
||||
-d ${UBUNTU_MIRROR_PROJECTS:-bionic,bionic-updates,bionic-security,bionic-backports} \
|
||||
-a ${MIRROR_ARCHITECTURES} \
|
||||
$SOURCEOPT \
|
||||
-s ${MIRROR_CATEGORIES} \
|
||||
-h ${UBUNTU_MIRROR_SOURCE} \
|
||||
-d ${UBUNTU_MIRROR_PROJECTS} \
|
||||
--ignore-small-errors \
|
||||
-r /ubuntu \
|
||||
--getcontents \
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/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=us.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 \
|
||||
--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