From 4d502ef68951228cb1d6faf43d2e56ccf7b5bfc9 Mon Sep 17 00:00:00 2001 From: wtarit <60599564+wtarit@users.noreply.github.com> Date: Sat, 14 Jun 2025 22:05:01 +0700 Subject: [PATCH 1/3] Add Github Actions Workflow --- .github/workflows/build-api-docker.yml | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/build-api-docker.yml diff --git a/.github/workflows/build-api-docker.yml b/.github/workflows/build-api-docker.yml new file mode 100644 index 0000000..60160e2 --- /dev/null +++ b/.github/workflows/build-api-docker.yml @@ -0,0 +1,43 @@ +name: Build Backend API Docker Image +on: [push] +jobs: + build-and-push-image: + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: api/ + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true From 620136bc312de34ff2607ca65656d182f6d2f50c Mon Sep 17 00:00:00 2001 From: wtarit <60599564+wtarit@users.noreply.github.com> Date: Sun, 15 Jun 2025 01:55:52 +0700 Subject: [PATCH 2/3] Add environment variables --- .github/workflows/build-api-docker.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-api-docker.yml b/.github/workflows/build-api-docker.yml index 60160e2..29b3676 100644 --- a/.github/workflows/build-api-docker.yml +++ b/.github/workflows/build-api-docker.yml @@ -1,5 +1,10 @@ name: Build Backend API Docker Image on: [push] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ring-notify-backend + jobs: build-and-push-image: runs-on: ubuntu-24.04 From 82b5b4b773185ec684d0352bf099ddc285a0bbed Mon Sep 17 00:00:00 2001 From: wtarit <60599564+wtarit@users.noreply.github.com> Date: Sun, 15 Jun 2025 02:00:57 +0700 Subject: [PATCH 3/3] Update Image name --- .github/workflows/build-api-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-api-docker.yml b/.github/workflows/build-api-docker.yml index 29b3676..aa3641f 100644 --- a/.github/workflows/build-api-docker.yml +++ b/.github/workflows/build-api-docker.yml @@ -3,7 +3,7 @@ on: [push] env: REGISTRY: ghcr.io - IMAGE_NAME: ring-notify-backend + IMAGE_NAME: wtarit/ring-notify-backend jobs: build-and-push-image: