Skip to content

Commit 4dd3228

Browse files
committed
Revert "Add GitHub Actions for publishing docker image"
This reverts commit beb9845.
1 parent beb9845 commit 4dd3228

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

.github/workflows/publish-docker-image.yml

+38-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Push Docker Images
1+
name: Publish Docker image
22

33
on:
44
workflow_run:
@@ -13,28 +13,48 @@ env:
1313
IMAGE_NAME: ${{ github.repository }}
1414

1515
jobs:
16-
build:
16+
build-and-push-image:
1717
runs-on: ubuntu-latest
18+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
24+
#
1825
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v3
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
2128

22-
- name: Set up Docker Buildx
23-
uses: docker/setup-buildx-action@v2
24-
25-
- name: Log in to GitHub Container Registry
26-
uses: docker/login-action@v2
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
2731
with:
28-
registry: ghcr.io
32+
registry: ${{ env.REGISTRY }}
2933
username: ${{ github.actor }}
3034
password: ${{ secrets.GITHUB_TOKEN }}
35+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels.
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
42+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
43+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
44+
- name: Build and push Docker image
45+
id: push
46+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
3152

32-
- name: Build and push Docker images using docker-compose
33-
run: |
34-
# Install Docker Compose
35-
sudo apt-get update
36-
sudo apt-get install -y docker-compose
53+
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
54+
- name: Generate artifact attestation
55+
uses: actions/attest-build-provenance@v1
56+
with:
57+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
58+
subject-digest: ${{ steps.push.outputs.digest }}
59+
push-to-registry: true
3760

38-
# Build and push images
39-
docker-compose build
40-
docker-compose push

0 commit comments

Comments
 (0)