-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (104 loc) · 3.36 KB
/
main.yaml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
---
name: Build
on:
push:
branches:
- master
- 'release/**'
pull_request:
jobs:
example-archlinux:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
id: meta
with:
images: example-archlinux
- name: Cache var-cache-pacman
uses: actions/cache@v3
with:
path: var-cache-pacman
key: var-cache-pacman-${{ hashFiles('Dockerfile.archlinux') }}
- name: inject var-cache-pacman into docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-cache-pacman
cache-target: /var/cache/pacman
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile.archlinux
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: extract var-cache-pacman from docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-cache-pacman
cache-target: /var/cache/pacman
example-debian:
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
dockerfile:
- "Dockerfile.debian-11"
- "Dockerfile.debian-12"
- "Dockerfile.ubuntu-2204"
- "Dockerfile.ubuntu-2304"
- "alternative/Dockerfile.debian-13"
- "alternative/Dockerfile.ubuntu-2310"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
id: meta
with:
images: example-debian
- name: Cache var-cache-apt
uses: actions/cache@v3
with:
path: var-cache-apt
key: var-cache-apt-${{ hashFiles(format('{0}', matrix.dockerfile)) }}
- name: Cache var-lib-apt
uses: actions/cache@v3
with:
path: var-lib-apt
key: var-lib-apt-${{ hashFiles(format('{0}', matrix.dockerfile)) }}
- name: inject var-cache-apt into docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-cache-apt
cache-target: /var/cache/apt
- name: inject var-lib-apt into docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-lib-apt
cache-target: /var/lib/apt
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
file: ${{ matrix.dockerfile }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: extract var-cache-apt from docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-cache-apt
cache-target: /var/cache/apt
- name: extract var-lib-apt from docker
uses: reproducible-containers/buildkit-cache-dance/[email protected]
with:
cache-source: var-lib-apt
cache-target: /var/lib/apt