Skip to content

Testing multi platform build. #275

Testing multi platform build.

Testing multi platform build. #275

name: Build and Publish
on:
# run it on push to the default repository branch
push:
branches: [master]
paths-ignore:
- '**/README.md'
- '**/*.drawio.svg'
- 'example/**'
- 'Compose/**'
# run it during pull request
pull_request:
jobs:
# define job to build and publish docker image
build-and-push-docker-image:
strategy:
matrix:
services:
- name: apm/rancher
directory: APM.Rancher
- name: api
directory: APC.API
- name: scheduler
directory: APC.Scheduler
- name: ingestion
directory: APC.Ingestion
- name: git-unpack
directory: APC.GitUnpack
- name: apm/container
directory: APM.Container
- name: apm/npm
directory: APM.Npm
- name: apm/php
directory: APM.Php
- name: apm/github/releases
directory: APM.Github.Releases
- name: apm/jetbrains
directory: APM.Jetbrains
- name: apm/jetbrains/ide
directory: APM.Jetbrains.IDE
- name: apm/nuget
directory: APM.Nuget
- name: apm/maven
directory: APM.Maven
- name: apm/pypi
directory: APM.Pypi
- name: apm/helm
directory: APM.Helm
- name: acm/http
directory: ACM.Http
- name: acm/git
directory: ACM.Git
- name: acm/wget
directory: ACM.Wget
- name: acm/router
directory: ACM.Router
- name: acm/container
directory: ACM.Container
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest
# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v3
# setup Docker buld action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to Docker Hub and GitHub Container Registry
uses: docker/build-push-action@v6
with:
# relative path to the place where source code with Dockerfile is located
platforms: linux/amd64,linux/arm64
context: .
file: ./${{ matrix.services.directory }}/Dockerfile
# Note: tags has to be all lower-case
tags: |
ghcr.io/linus-berg/apc/${{ matrix.services.name }}:latest
ghcr.io/linus-berg/apc/${{ matrix.services.name }}:${{ github.sha }}
# build on feature branches, push only on main branch
push: ${{ github.ref == 'refs/heads/master' }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}