From bf663ebbf79c83a7c2cbe49cbfc2e6d46e668fab Mon Sep 17 00:00:00 2001 From: wkmor1 Date: Tue, 9 Jul 2024 11:34:02 +0300 Subject: [PATCH] Add image building github action --- .github/workflows/docker-publish.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..7dc6f32 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,43 @@ +name: Publish Docker Image + +on: + push: + branches: ['main', 'dev'] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Buildah Action + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: ${{ steps.meta.outputs.tags }} + oci: true + containerfiles: | + ./Dockerfile.rahti + + - name: Push To GHCR + uses: redhat-actions/push-to-registry@v2 + with: + tags: ${{ steps.build_image.outputs.tags }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }}