From 1b937e82ce5b195585570904599a9f06efdd7ba4 Mon Sep 17 00:00:00 2001 From: Rifki Pratama <73276619+rifkiyupra@users.noreply.github.com> Date: Thu, 30 Jan 2025 04:16:32 +0700 Subject: [PATCH] create workflow (#4) Lgtm --- .github/workflows/docker-build.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..480b6ba --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,36 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - workflow # Trigger workflow on push to the main branch + pull_request: + branches: + - main # Optional: Run the workflow on PRs targeting main + +jobs: + build-and-push: + runs-on: image-builder + + permissions: + contents: read + packages: write # Required to push to GitHub Container Registry + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.ACCESS_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ghcr.io/${{ github.repository }}:latest \ No newline at end of file