-
-
Notifications
You must be signed in to change notification settings - Fork 9
91 lines (78 loc) · 2.95 KB
/
Copy pathbuild-apt-cacher-ng.yml
File metadata and controls
91 lines (78 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: apt-cacher-ng Image
on:
push:
branches:
- main
paths:
- '.github/workflows/build-apt-cacher-ng.yml'
workflow_dispatch:
schedule:
- cron: '0 4 * * 1' # Weekly, Monday 04:00 UTC — pick up trixie point/security updates
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build:
name: "Build apt-cacher-ng (trixie)"
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dockerfile
run: |
cat > Dockerfile <<'DOCKEREOF'
# Current apt-cacher-ng from Debian trixie (3.7.x) — the classical
# multi-repo caching apt proxy. Replaces the abandoned 2020
# sameersbn/apt-cacher-ng:3.3 image with ~4 years of reliability
# fixes (index handling, concurrency, HTTPS remapping).
FROM debian:trixie-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-cacher-ng \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Override config: cache on a bind-mountable volume, run in the
# foreground (PID 1), allow HTTPS repos via CONNECT tunneling, and
# never expire cached packages (host has plenty of disk).
RUN printf '%s\n' \
'CacheDir: /var/cache/apt-cacher-ng' \
'LogDir: /var/log/apt-cacher-ng' \
'ForeGround: 1' \
'PassThroughPattern: .*' \
'ExThreshold: 0' \
'VerboseLog: 0' \
> /etc/apt-cacher-ng/zzz_armbian.conf
VOLUME ["/var/cache/apt-cacher-ng"]
EXPOSE 3142
CMD ["/usr/sbin/apt-cacher-ng", "-c", "/etc/apt-cacher-ng"]
DOCKEREOF
- name: Build and push image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ env.REGISTRY }}/apt-cacher-ng:latest
${{ env.REGISTRY }}/apt-cacher-ng:trixie
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
load: false
- name: Image built
run: |
echo "::notice::Built and pushed ${{ env.REGISTRY }}/apt-cacher-ng:latest (linux/amd64, linux/arm64)"
echo '# apt-cacher-ng image' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo "Pushed \`${{ env.REGISTRY }}/apt-cacher-ng:latest\` and \`:trixie\` (linux/amd64, linux/arm64) ✅" >> $GITHUB_STEP_SUMMARY