change triger workflow and multi platforms (#3) #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- main # 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 | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
tags: ghcr.io/${{ github.repository }}:latest |