Build toolbox for multiple arch #144
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: Docker | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME: toolbox | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image | |
run: | |
docker buildx build --platform linux/arm64,linux/amd64 -t "$IMAGE_NAME" . | |
- name: Log into github registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image to github registry | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }} | |
docker push $IMAGE_ID:latest | |
docker push $IMAGE_ID:${{ github.sha }} | |
- name: Log into docker hub registry | |
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u apexskier --password-stdin | |
- name: Push image to docker hub registry | |
run: | | |
IMAGE_ID=apexskier/$IMAGE_NAME | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }} | |
docker push $IMAGE_ID:latest | |
docker push $IMAGE_ID:${{ github.sha }} |