From c5f08c6adb46865fd284a4986696b1d3c7a77a6c Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 29 Apr 2024 11:31:54 +0200 Subject: [PATCH] dockerhub support (#1) --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69bb665..0fe94f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: release on: + workflow_dispatch: ~ push: branches: [main] @@ -52,3 +53,43 @@ jobs: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} subject-digest: ${{ steps.docker-push.outputs.digest }} push-to-registry: true + + docker-hub: + runs-on: ubuntu-latest + env: + REGISTRY: index.docker.io + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: docker-meta + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + tags: | + type=raw,value=latest,enable=true + type=ref,enable=true,prefix=,suffix=,event=tag + + - name: Build and push image + id: docker-push + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + with: + context: . + push: true + tags: ${{ steps.docker-meta.outputs.tags }} + labels: ${{ steps.docker-meta.outputs.labels }} + + - name: Attest image + uses: github-early-access/generate-build-provenance@main + with: + subject-name: ${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + subject-digest: ${{ steps.docker-push.outputs.digest }} + push-to-registry: true diff --git a/Dockerfile b/Dockerfile index 8727c9b..535dc93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ -FROM ubuntu:22.04 +FROM alpine:latest RUN echo 'Hello, World!' \ No newline at end of file