GHA on push #1
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: MultiArchDockerBuild | |
on: | |
push: | |
branches: | |
- main | |
- feature/docker-container | |
jobs: | |
docker: | |
name: Build multi-arch Docker image. | |
runs-on: ubuntu-latest | |
steps: | |
- name: tag number | |
run : echo ${{ github.event.release.tag_name }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set lower case owner name | |
run: | | |
echo "REG_REPO=${REPO,,}" >> ${GITHUB_ENV} | |
env: | |
REPO: '${{ github.repository }}' | |
- name: Check env | |
run: | | |
echo ${{ env.REG_REPO }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/jacred:latest | |
ghcr.io/${{ env.REG_REPO }}:latest | |
cache-from: type=gha,scope=${{ github.workflow }} | |
cache-to: type=gha,mode=max,scope=${{ github.workflow }} |