Commit 7e36357a authored by nanahira's avatar nanahira

update apt-cacher

parent 9aea1246
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
state: directory state: directory
with_items: with_items:
- smartdns - smartdns
- apt-cacher-ng-docker
- sni - sni
- name: smartdns - name: smartdns
template: template:
...@@ -35,14 +34,12 @@ ...@@ -35,14 +34,12 @@
checksum: yes checksum: yes
archive: no archive: no
notify: restart_sni notify: restart_sni
- name: apt cacher Dockerfile - name: apt cacher Dockerfile clean
template: file:
src: ./apt-cacher-ng-docker/Dockerfile.j2 path: '{{utility_root}}/apt-cacher-ng-docker'
dest: '{{utility_root}}/apt-cacher-ng-docker/Dockerfile' state: absent
register: dockerfile_res
- name: docker-compose up -d - name: docker-compose up -d
docker_compose: docker_compose:
project_src: '{{utility_root}}' project_src: '{{utility_root}}'
remove_orphans: true remove_orphans: true
pull: true pull: true
build: '{{dockerfile_res.changed}}'
FROM debian:buster-slim
{% if apt_mirror != 'deb.debian.org' %}
RUN sed -i 's/deb.debian.org/{{apt_mirror}}/g;s/security.debian.org/{{apt_mirror}}/g' /etc/apt/sources.list
{% endif %}
RUN apt update && apt install -y apt-cacher-ng && rm -rf /var/lib/apt/lists/*
RUN sed -i 's/# ForeGround: 0/ForeGround: 1/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-debrep: .*/Remap-debrep: \/debian ; http:\/\/{{apt_mirror}}\/debian/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-uburep: .*/Remap-uburep: \/ubuntu ; http:\/\/{{apt_mirror}}\/ubuntu/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-secdeb: .*/Remap-debdeb: \/debian-security ; http:\/\/{{apt_mirror}}\/debian-security/' /etc/apt-cacher-ng/acng.conf
RUN ln -s /dev/stdout /var/log/apt-cacher-ng/apt-cacher.log && ln -s /dev/stderr /var/log/apt-cacher-ng.err
EXPOSE 3142/tcp
CMD [ "/usr/sbin/apt-cacher-ng", "-c", "/etc/apt-cacher-ng" ]
...@@ -51,18 +51,20 @@ services: ...@@ -51,18 +51,20 @@ services:
apt-cacher-ng: apt-cacher-ng:
restart: always restart: always
build: apt-cacher-ng-docker image: git-registry.mycard.moe/nanahira/apt-cacher-ng-docker:latest
dns: {{ smartdns_china_dns[0] }} dns: {{ smartdns_china_dns[0] }}
ports: ports:
{% if apt_cacher_address %} {% if apt_cacher_address %}
{% for address in apt_cacher_address %} {% for address in apt_cacher_address %}
- '{{address}}:80:3142' - '{{address}}:80:80'
{% endfor %} {% endfor %}
{% else %} {% else %}
- '80:3142' - '80:80'
{% endif %} {% endif %}
volumes: volumes:
- {{apt_cacher_path}}:/var/cache/apt-cacher-ng - {{apt_cacher_path}}:/var/cache/apt-cacher-ng
environment:
UPSTREAM_MIRROR: {{apt_mirror}}
sni: sni:
restart: always restart: always
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment