-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (70 loc) · 2.57 KB
/
Copy pathdocker-build-push.yml
File metadata and controls
79 lines (70 loc) · 2.57 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
name: Build and publish Docker images
on:
push:
branches:
- main
paths-ignore:
- legacy/**
pull_request:
paths-ignore:
- legacy/**
schedule:
# Daily rebuild, to pick up upstream Alpine security updates.
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
# A run that publishes must never be interrupted: the images share mutable tags,
# so two concurrent runs could push `latest` from two different builds, and a
# cancellation between the two build steps would publish one image and not the
# other. A run that publishes nothing is cancelled when superseded.
concurrency:
group: docker-build-push-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
# The Dockerfile asserts these versions at build time, so the tags are read
# from it rather than repeated here, where they could drift.
- name: Read the advertised versions
id: versions
run: |
set -euo pipefail
python=$(sed -n 's/^ARG PYTHON_VERSION=//p' Dockerfile)
nodejs=$(sed -n 's/^ARG NODEJS_VERSION=//p' Dockerfile)
test -n "${python}" && test -n "${nodejs}"
echo "python=${python}" >> "$GITHUB_OUTPUT"
echo "nodejs=${nodejs}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build filigran/alpine-python-fips
uses: docker/build-push-action@v7
with:
context: .
target: python-fips
platforms: linux/amd64
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
filigran/alpine-python-fips:python${{ steps.versions.outputs.python }}
filigran/alpine-python-fips:latest
- name: Build filigran/alpine-python-nodejs-fips
uses: docker/build-push-action@v7
with:
context: .
target: python-nodejs-fips
platforms: linux/amd64
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
filigran/alpine-python-nodejs-fips:python${{ steps.versions.outputs.python }}-nodejs${{ steps.versions.outputs.nodejs }}
filigran/alpine-python-nodejs-fips:latest