-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (181 loc) · 5.63 KB
/
docker.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Docker Image Builds
on:
push:
branches: [main]
tags: [v*.*.*]
pull_request:
schedule:
- cron: 16 9 * * *
workflow_dispatch:
inputs:
force_build:
description: comma-separated list of container names which should be force-rebuilt
default: ''
required: false
type: string
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
ORG: backplane
PSUM_LABEL: be.backplane.image.context_psum
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
LICENSES: Various Open Source
PLATFORMS_OVERRIDE_FILE: .build_platforms.txt
LICENSES_OVERRIDE_FILE: LICENSES.txt
jobs:
build-push:
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
max-parallel: 6
fail-fast: false
matrix:
container:
- 7z
- abe
- adb
- amplify-vueenv
- ansible
- apg
- audiosprite
- aws-cli
- bind
- black
- blampy
- bpython
- cdk-python
- chardet
- checkmake
- chrome
- chromium
- compose_sort
- conex-helper
- desktop-reclaim-space
- 'false'
- firefox
- fzf
- ghlatest
- goenv
- graphviz
- grta
- haskellenv
- htpasswd
- httpie
- hugo
- jq
- json-server
- kp1p
- lxde
- mate
- minidlna
- mssql-cli
- mssql-scripter
- myip
- mypy
- ods_conv
- pdf
- pgformatter
- proxyport
- pwgen
- pycodestyle
- pygmentize
- pylint
- qrencode
- shunit2
- snakeeyes
- sql-formatter
- toybox
- 'true'
- tsqllint
- update_requirements
- vueenv
- wimlib-imagex
- wireguard
- wpa_passphrase
- yamllint
- youtube-dl
- yq
steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v3
# some custom outputs for use later in the build
- name: Load Custom Data
id: cdata
run: |
#!/bin/sh
set -ex
# ensure the required environment variables are set
: "${REGISTRY:?}" # this is used in subsequent steps
: "${ORG:?}"
: "${PSUM_LABEL:?}"
# generate some outputs about the container being built
docker run \
--rm \
--pull "always" \
--user "$(id -u)" \
--env "GITHUB_OUTPUT" \
--volume "$(pwd):/work" \
--volume "/home/runner:/home/runner" \
backplane/conex-helper \
metadata \
--forcedbuilds '${{ github.event.inputs.force_build }}' \
'${{ matrix.container }}'
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
uses: docker/setup-buildx-action@v2
# https://github.com/docker/login-action
- name: Login to Docker Hub
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.container }}
tags: |
type=raw,value=latest
flavor: |
latest=false
labels: |
org.opencontainers.image.title=${{ matrix.container }}
org.opencontainers.image.source=https://github.com/backplane/conex/tree/main/${{ matrix.container }}
org.opencontainers.image.licenses=${{ steps.cdata.outputs.licenses }}
org.opencontainers.image.description=${{ steps.cdata.outputs.description }}
# https://github.com/docker/build-push-action
- name: Build and push Docker image
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
uses: docker/build-push-action@v4
with:
context: ${{ matrix.container }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }}
${{ env.PSUM_LABEL }}=${{ steps.cdata.outputs.psum }}
platforms: ${{ steps.cdata.outputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
# https://github.com/peter-evans/dockerhub-description
- name: Update Docker Hub Description
if: ${{ steps.cdata.outputs.skipbuild != '1' }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.ORG }}/${{ matrix.container }}
short-description: ${{ steps.cdata.outputs.description }}
readme-filepath: ${{ matrix.container }}/README.md