This commit is contained in:
Jeffrey Paul 2016-04-08 22:41:48 +02:00
commit 967dffa798
6 changed files with 94 additions and 0 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM phusion/baseimage:0.9.17
VOLUME /var/mirror
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d
RUN apt-get update
RUN apt-get install -y run-one nginx make debmirror
ADD ./mirror /opt/mirror
ADD ./mirror.run /etc/service/mirror/run
ADD nginx.conf /etc/nginx/nginx.conf
ADD ./nginx.run /etc/service/nginx/run
RUN chmod +x /etc/service/nginx/run && \
chmod +x /etc/service/mirror/run
RUN \
gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg && \
gpg --import /usr/share/keyrings/ubuntu-master-keyring.gpg
EXPOSE 80

4
mirror.run Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
cd /opt/mirror && make
sleep 21600

6
mirror/Makefile Normal file
View File

@ -0,0 +1,6 @@
.PHONY: mirror
default: mirror
mirror:
run-one-until-success bash mirror.sh

19
mirror/syncubuntu.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -x
THISDIR="$(cd $(dirname "$BASH_SOURCE") && pwd -P)"
DST="/var/mirror"
debmirror \
-a i386,amd64 \
--no-source \
-s main,restricted,universe,multiverse \
-h ${UBUNTU_MIRROR_SOURCE:-archive.ubuntu.com}
-d trusty,trusty-updates,trusty-security,trusty-backports \
-d xenial,xenial-updates,xenial-security,xenial-backports \
-r /ubuntu \
--progress \
--method=http \
$DST/ubuntu
chmod -R a+rX $DST/ubuntu

41
nginx.conf Normal file
View File

@ -0,0 +1,41 @@
user daemon;
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 10;
gzip off;
# default, no host name
server {
listen 80 default_server;
charset utf-8;
server_name _;
root /var/empty;
index index.html index.htm;
location / {
deny all;
}
location /ubuntu/ {
root /var/mirror/ubuntu;
autoindex on;
}
}
}

3
nginx.run Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
exec nginx -g "daemon off;"