Skip to content

Commit c3f1336

Browse files
committed
File correction
1 parent ad83035 commit c3f1336

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/docker-image.yml

+18-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ on:
55
- cron: '24 9 * * *'
66
push:
77
branches: [ "main" ]
8+
# Publish semver tags as releases.
89
tags: [ 'v*.*.*' ]
910
pull_request:
1011
branches: [ "main" ]
1112

1213
env:
14+
# Use docker.io for Docker Hub if empty
1315
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
1417
IMAGE_NAME: ${{ github.repository }}
1518

1619
jobs:
@@ -19,7 +22,6 @@ jobs:
1922
strategy:
2023
matrix:
2124
php-version: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] # PHP versions to build
22-
architecture: [ 'amd64', 'arm64' ] # Add architecture matrix
2325

2426
permissions:
2527
contents: read
@@ -30,9 +32,18 @@ jobs:
3032
- name: Checkout repository
3133
uses: actions/checkout@v4
3234

33-
- name: Set up BuildKit Docker container builder
35+
# Install the cosign tool except on PR
36+
- name: Install cosign
37+
if: github.event_name != 'pull_request'
38+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
39+
with:
40+
cosign-release: 'v2.2.4'
41+
42+
# Set up BuildKit Docker container builder
43+
- name: Set up Docker Buildx
3444
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
3545

46+
# Login against a Docker registry except on PR
3647
- name: Log into registry ${{ env.REGISTRY }}
3748
if: github.event_name != 'pull_request'
3849
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
@@ -41,6 +52,7 @@ jobs:
4152
username: ${{ github.actor }}
4253
password: ${{ secrets.GITHUB_TOKEN }}
4354

55+
# Extract metadata (tags, labels) for Docker
4456
- name: Extract Docker metadata
4557
id: meta
4658
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
@@ -50,7 +62,8 @@ jobs:
5062
${{ matrix.php-version }}-${{ github.sha }}
5163
${{ matrix.php-version }}-latest
5264
${{ matrix.php-version }}
53-
65+
66+
# Build and push Docker image with Buildx (don't push on PR)
5467
- name: Build and push Docker image
5568
id: build-and-push
5669
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
@@ -64,11 +77,11 @@ jobs:
6477
cache-to: type=gha,mode=max
6578
build-args: |
6679
PHP_VERSION=${{ matrix.php-version }}
67-
ARCH=${{ matrix.architecture }} # Pass architecture to Dockerfile
6880
81+
# Sign the resulting Docker image digest except on PRs.
6982
- name: Sign the published Docker image
7083
if: ${{ github.event_name != 'pull_request' }}
7184
env:
7285
TAGS: ${{ steps.meta.outputs.tags }}
7386
DIGEST: ${{ steps.build-and-push.outputs.digest }}
74-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
87+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 commit comments

Comments
 (0)