name: Build and Push Docker Image on: push: branches: [main] jobs: build: runs-on: ubuntu-22.04-full steps: - uses: actions/checkout@v4 - name: Login to Registry uses: docker/login-action@v2 with: registry: git.kocoder.xyz username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Buildah Build env: BRANCH_NAME: ${{ github.ref_name }} SHORT_HASH: ${{ github.sha }} uses: redhat-actions/buildah-build@v2 with: containerfiles: "Dockerfile" image: git.kocoder.xyz/kocoded/vt-be tags: "${{ github.ref_name }} latest" extra-args: | --isolation=chroot - name: Push Docker Images env: BRANCH_NAME: ${{ github.ref_name }} SHORT_HASH: ${{ github.sha }} run: | docker push git.kocoder.xyz/kocoded/vt-be:${BRANCH_NAME} docker push git.kocoder.xyz/kocoded/vt-be:latest - name: Log out from registry if: always() run: docker logout git.kocoder.xyz