diff --git a/.github/workflows/github-build-push.yml b/.github/workflows/github-build-push.yml index 7b55f70..664dd88 100644 --- a/.github/workflows/github-build-push.yml +++ b/.github/workflows/github-build-push.yml @@ -1,27 +1,38 @@ -name: gh-ci +name: Build and Push Container on: push: branches: - - 'main' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + - main jobs: - build: + build-and-push: runs-on: ubuntu-latest - + steps: - - uses: actions/checkout@master - - name: Publish Docker Image - # You may pin to the exact commit or the version. - # uses: elgohr/Publish-Docker-Github-Action@191af57e15535d28b83589e3b5f0c31e76aa8733 - uses: elgohr/Publish-Docker-Github-Action@3.04 - with: - # The name of the image you would like to push - name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ${{ env.REGISTRY }} \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Containers + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ github.sha }} diff --git a/github-build-push.yml b/github-build-push.yml new file mode 100644 index 0000000..7b55f70 --- /dev/null +++ b/github-build-push.yml @@ -0,0 +1,27 @@ +name: gh-ci + +on: + push: + branches: + - 'main' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Publish Docker Image + # You may pin to the exact commit or the version. + # uses: elgohr/Publish-Docker-Github-Action@191af57e15535d28b83589e3b5f0c31e76aa8733 + uses: elgohr/Publish-Docker-Github-Action@3.04 + with: + # The name of the image you would like to push + name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ env.REGISTRY }} \ No newline at end of file