Add arm images for sample apps #14
This file contains hidden or 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: "Sample Apps Build" | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
docker: | |
strategy: | |
matrix: | |
variants: | |
- type: aspnetcore | |
dockerfile: "src/aspnetcore/Dockerfile" | |
context: "src/aspnetcore" | |
platforms: "linux/amd64,linux/arm64" | |
- type: fastify-esm | |
dockerfile: "src/fastify-esm/Dockerfile" | |
context: "src/fastify-esm" | |
platforms: "linux/amd64,linux/arm64" | |
- type: flask | |
dockerfile: "src/flask/Dockerfile" | |
context: "src/flask" | |
platforms: "linux/amd64,linux/arm64" | |
- type: php | |
dockerfile: "src/php/Dockerfile" | |
context: "src/php" | |
platforms: "linux/amd64,linux/arm64" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
version: latest | |
- name: Login (Dockerhub) | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: docker.io/contrast/sample-app-${{ matrix.variants.type }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: ${{ matrix.variants.platforms }} | |
file: ${{ matrix.variants.dockerfile }} | |
context: ${{ matrix.variants.context }} | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true |