Skip to content

Commit c8d271e

Browse files
Merge pull request #31 from leojonathanoh/feature/add-alpine-3.20-variants
Feature: Add alpine 3.20 variants
2 parents 9e79cf3 + 940a2aa commit c8d271e

File tree

11 files changed

+608
-3
lines changed

11 files changed

+608
-3
lines changed

.github/workflows/ci-master-pr.yml

Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,327 @@ jobs:
3333
run: |
3434
git diff --exit-code
3535
36+
build-3-20:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Display system info (linux)
43+
run: |
44+
set -e
45+
hostname
46+
whoami
47+
cat /etc/*release
48+
lscpu
49+
free
50+
df -h
51+
pwd
52+
docker info
53+
docker version
54+
55+
# See: https://github.com/docker/build-push-action/blob/v2.6.1/docs/advanced/cache.md#github-cache
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v3
58+
59+
- name: Set up Docker Buildx
60+
id: buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Cache Docker layers
64+
uses: actions/cache@v4
65+
with:
66+
path: /tmp/.buildx-cache
67+
key: ${{ runner.os }}-buildx-3.20-${{ github.sha }}
68+
restore-keys: |
69+
${{ runner.os }}-buildx-3.20-
70+
${{ runner.os }}-buildx-
71+
72+
- name: Login to Docker Hub registry
73+
# Run on master and tags
74+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
75+
uses: docker/login-action@v3
76+
with:
77+
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
78+
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
79+
80+
# This step generates the docker tags
81+
- name: Prepare
82+
id: prep-3-20
83+
run: |
84+
set -e
85+
86+
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
87+
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
88+
89+
# Get short commit hash E.g. 'abc0123'
90+
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
91+
92+
# Generate docker image tags
93+
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
94+
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
95+
VARIANT="3.20"
96+
REF_VARIANT="${REF}-${VARIANT}"
97+
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
98+
99+
# Pass variables to next step
100+
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
101+
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
102+
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
103+
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
104+
105+
- name: 3.20 - Build (PRs)
106+
# Run only on pull requests
107+
if: github.event_name == 'pull_request'
108+
uses: docker/build-push-action@v5
109+
with:
110+
context: variants/3.20
111+
platforms:
112+
push: false
113+
tags: |
114+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
115+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
116+
cache-from: type=local,src=/tmp/.buildx-cache
117+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
118+
119+
- name: 3.20 - Build and push (master)
120+
# Run only on master
121+
if: github.ref == 'refs/heads/master'
122+
uses: docker/build-push-action@v5
123+
with:
124+
context: variants/3.20
125+
platforms:
126+
push: true
127+
tags: |
128+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
129+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
130+
cache-from: type=local,src=/tmp/.buildx-cache
131+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
132+
133+
- name: 3.20 - Build and push (release)
134+
if: startsWith(github.ref, 'refs/tags/')
135+
uses: docker/build-push-action@v5
136+
with:
137+
context: variants/3.20
138+
platforms:
139+
push: true
140+
tags: |
141+
${{ github.repository }}:${{ steps.prep-3-20.outputs.VARIANT }}
142+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
143+
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
144+
${{ github.repository }}:latest
145+
cache-from: type=local,src=/tmp/.buildx-cache
146+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
147+
148+
# This step generates the docker tags
149+
- name: Prepare
150+
id: prep-3-20-mysqlclient
151+
run: |
152+
set -e
153+
154+
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
155+
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
156+
157+
# Get short commit hash E.g. 'abc0123'
158+
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
159+
160+
# Generate docker image tags
161+
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
162+
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
163+
VARIANT="3.20-mysqlclient"
164+
REF_VARIANT="${REF}-${VARIANT}"
165+
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
166+
167+
# Pass variables to next step
168+
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
169+
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
170+
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
171+
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
172+
173+
- name: 3.20-mysqlclient - Build (PRs)
174+
# Run only on pull requests
175+
if: github.event_name == 'pull_request'
176+
uses: docker/build-push-action@v5
177+
with:
178+
context: variants/3.20-mysqlclient
179+
platforms:
180+
push: false
181+
tags: |
182+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
183+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
184+
cache-from: type=local,src=/tmp/.buildx-cache
185+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
186+
187+
- name: 3.20-mysqlclient - Build and push (master)
188+
# Run only on master
189+
if: github.ref == 'refs/heads/master'
190+
uses: docker/build-push-action@v5
191+
with:
192+
context: variants/3.20-mysqlclient
193+
platforms:
194+
push: true
195+
tags: |
196+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
197+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
198+
cache-from: type=local,src=/tmp/.buildx-cache
199+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
200+
201+
- name: 3.20-mysqlclient - Build and push (release)
202+
if: startsWith(github.ref, 'refs/tags/')
203+
uses: docker/build-push-action@v5
204+
with:
205+
context: variants/3.20-mysqlclient
206+
platforms:
207+
push: true
208+
tags: |
209+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.VARIANT }}
210+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
211+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
212+
cache-from: type=local,src=/tmp/.buildx-cache
213+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
214+
215+
# This step generates the docker tags
216+
- name: Prepare
217+
id: prep-3-20-openssl
218+
run: |
219+
set -e
220+
221+
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
222+
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
223+
224+
# Get short commit hash E.g. 'abc0123'
225+
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
226+
227+
# Generate docker image tags
228+
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
229+
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
230+
VARIANT="3.20-openssl"
231+
REF_VARIANT="${REF}-${VARIANT}"
232+
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
233+
234+
# Pass variables to next step
235+
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
236+
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
237+
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
238+
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
239+
240+
- name: 3.20-openssl - Build (PRs)
241+
# Run only on pull requests
242+
if: github.event_name == 'pull_request'
243+
uses: docker/build-push-action@v5
244+
with:
245+
context: variants/3.20-openssl
246+
platforms:
247+
push: false
248+
tags: |
249+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
250+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
251+
cache-from: type=local,src=/tmp/.buildx-cache
252+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
253+
254+
- name: 3.20-openssl - Build and push (master)
255+
# Run only on master
256+
if: github.ref == 'refs/heads/master'
257+
uses: docker/build-push-action@v5
258+
with:
259+
context: variants/3.20-openssl
260+
platforms:
261+
push: true
262+
tags: |
263+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
264+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
265+
cache-from: type=local,src=/tmp/.buildx-cache
266+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
267+
268+
- name: 3.20-openssl - Build and push (release)
269+
if: startsWith(github.ref, 'refs/tags/')
270+
uses: docker/build-push-action@v5
271+
with:
272+
context: variants/3.20-openssl
273+
platforms:
274+
push: true
275+
tags: |
276+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.VARIANT }}
277+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
278+
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
279+
cache-from: type=local,src=/tmp/.buildx-cache
280+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
281+
282+
# This step generates the docker tags
283+
- name: Prepare
284+
id: prep-3-20-mysqlclient-openssl
285+
run: |
286+
set -e
287+
288+
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
289+
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
290+
291+
# Get short commit hash E.g. 'abc0123'
292+
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
293+
294+
# Generate docker image tags
295+
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
296+
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
297+
VARIANT="3.20-mysqlclient-openssl"
298+
REF_VARIANT="${REF}-${VARIANT}"
299+
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
300+
301+
# Pass variables to next step
302+
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
303+
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
304+
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
305+
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
306+
307+
- name: 3.20-mysqlclient-openssl - Build (PRs)
308+
# Run only on pull requests
309+
if: github.event_name == 'pull_request'
310+
uses: docker/build-push-action@v5
311+
with:
312+
context: variants/3.20-mysqlclient-openssl
313+
platforms:
314+
push: false
315+
tags: |
316+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
317+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
318+
cache-from: type=local,src=/tmp/.buildx-cache
319+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
320+
321+
- name: 3.20-mysqlclient-openssl - Build and push (master)
322+
# Run only on master
323+
if: github.ref == 'refs/heads/master'
324+
uses: docker/build-push-action@v5
325+
with:
326+
context: variants/3.20-mysqlclient-openssl
327+
platforms:
328+
push: true
329+
tags: |
330+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
331+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
332+
cache-from: type=local,src=/tmp/.buildx-cache
333+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
334+
335+
- name: 3.20-mysqlclient-openssl - Build and push (release)
336+
if: startsWith(github.ref, 'refs/tags/')
337+
uses: docker/build-push-action@v5
338+
with:
339+
context: variants/3.20-mysqlclient-openssl
340+
platforms:
341+
push: true
342+
tags: |
343+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.VARIANT }}
344+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
345+
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
346+
cache-from: type=local,src=/tmp/.buildx-cache
347+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
348+
349+
# Temp fix
350+
# https://github.com/docker/build-push-action/issues/252
351+
# https://github.com/moby/buildkit/issues/1896
352+
- name: Move cache
353+
run: |
354+
rm -rf /tmp/.buildx-cache
355+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
356+
36357
build-3-17:
37358
runs-on: ubuntu-latest
38359
steps:
@@ -998,6 +1319,7 @@ jobs:
9981319
9991320
update-draft-release:
10001321
needs:
1322+
- build-3-20
10011323
- build-3-17
10021324
- build-3-15
10031325
- build-3-12
@@ -1014,6 +1336,7 @@ jobs:
10141336

10151337
publish-draft-release:
10161338
needs:
1339+
- build-3-20
10171340
- build-3-17
10181341
- build-3-15
10191342
- build-3-12
@@ -1032,6 +1355,7 @@ jobs:
10321355

10331356
update-dockerhub-description:
10341357
needs:
1358+
- build-3-20
10351359
- build-3-17
10361360
- build-3-15
10371361
- build-3-12

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Packages included for all images: `curl`, `wget`
1212

1313
| Tag | Dockerfile Build Context |
1414
|:-------:|:---------:|
15+
| `:3.20`, `:latest` | [View](variants/3.20) |
16+
| `:3.20-mysqlclient` | [View](variants/3.20-mysqlclient) |
17+
| `:3.20-openssl` | [View](variants/3.20-openssl) |
18+
| `:3.20-mysqlclient-openssl` | [View](variants/3.20-mysqlclient-openssl) |
1519
| `:3.17`, `:latest` | [View](variants/3.17) |
1620
| `:3.17-mysqlclient` | [View](variants/3.17-mysqlclient) |
1721
| `:3.17-openssl` | [View](variants/3.17-openssl) |
@@ -32,15 +36,15 @@ Example 1: Create one cron that runs as `root`
3236
```sh
3337
docker run -it \
3438
-e CRON='* * * * * /bin/echo "hello"' \
35-
theohbrothers/docker-alpine-cron:3.17
39+
theohbrothers/docker-alpine-cron:3.20
3640
```
3741

3842
Example 2: Create two crons that run as `root`
3943

4044
```sh
4145
docker run -it \
4246
-e CRON='* * * * * /bin/echo "hello"\n* * * * * /bin/echo "world"' \
43-
theohbrothers/docker-alpine-cron:3.17
47+
theohbrothers/docker-alpine-cron:3.20
4448
```
4549

4650
Example 3: Create two crons that run as UID `3000` and GID `4000`
@@ -50,7 +54,7 @@ docker run -it \
5054
-e CRON='* * * * * /bin/echo "hello"\n* * * * * /bin/echo "world"' \
5155
-e CRON_UID=3000 \
5256
-e CRON_GID=4000 \
53-
theohbrothers/docker-alpine-cron:3.17
57+
theohbrothers/docker-alpine-cron:3.20
5458
```
5559

5660
### Environment variables

generate/definitions/VARIANTS.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$local:VARIANTS_DISTRO_VERSIONS = @(
2+
'3.20'
23
'3.17'
34
'3.15'
45
'3.12'

0 commit comments

Comments
 (0)