-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (65 loc) · 2.24 KB
/
Copy pathdocker_base.yaml
File metadata and controls
75 lines (65 loc) · 2.24 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
# Reusable workflow that creates base images, as specified in the
# repository Dockerfile (most commonly, with build dependencies and
# devtools virtualenv pre-installed).
#
# Notes:
#
# - Docker registry is always Github’s own ghcr.io.
#
# - Dockerfile path must be debian/images/Dockerfile.
#
# - the supplied codenames are used as raw image labels.
name: Docker dependency images
on:
workflow_call:
inputs:
codenames:
type: string
required: true
description: "Stringified JSON array listing target codenames"
secrets:
repository:
required: true
description: >-
The repository name, as in org-name/reponame.
MUST BE FULLY IN LOWERCASE.
This is a secret, and not an input, because we use org-wide
secrets to provide a lowercase version of organization names,
and still work across forks, without hard-coding any names.
jobs:
build-image:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(inputs.codenames) }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- id: meta
name: Extract tags and labels for Docker
uses: docker/metadata-action@v3
with:
tags: |
type=raw,${{ matrix.target }}
flavor: |
latest=false
images: ghcr.io/${{ secrets.repository }}
- name: Build image and push to registry
uses: docker/build-push-action@v2
with:
file: debian/images/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CODENAME=${{ matrix.target }}
cache-to: type=registry,ref=ghcr.io/${{ secrets.repository }}:${{ matrix.target }}-cache,mode=max
cache-from: type=registry,ref=ghcr.io/${{ secrets.repository }}:${{ matrix.target }}-cache