Test tweak to build action #25
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: Build Containers | |
on: | |
push: | |
branches: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-shared: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and export | |
uses: docker/build-push-action@v4 | |
with: | |
context: "{{defaultContext}}:containers/shared" | |
tags: hra-workflows/shared:main | |
outputs: type=docker,dest=/tmp/shared.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: shared | |
path: /tmp/shared.tar | |
build-and-push: | |
runs-on: ubuntu-latest | |
needs: build-shared | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
container: [azimuth, celltypist, extract-summary, popv] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Download shared artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: shared | |
path: /tmp | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.container }} | |
- name: Load shared image | |
run: | | |
docker load --input /tmp/shared.tar | |
docker image ls -a | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: "{{defaultContext}}:containers/${{ matrix.container }}" | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |