Created
April 22, 2022 16:08
-
-
Save amessinger/aa79c867e8658a836e34cd93e07210cb to your computer and use it in GitHub Desktop.
Github Action Workflow to build and push an image to both GH and Scaleway registries
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: Container image | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- 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.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Scaleway Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.SCALEWAY_REGISTRY_ENDPOINT }} | |
username: ${{ secrets.SCALEWAY_REGISTRY_USERNAME }} | |
password: ${{ secrets.SCALEWAY_REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/amessinger/${{ github.event.repository.name }}:latest | |
${{ secrets.SCALEWAY_REGISTRY_ENDPOINT }}/${{ github.event.repository.name }}:latest | |
cache-from: type=registry,ref=ghcr.io/amessinger/${{ github.event.repository.name }}:latest | |
cache-to: type=inline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment