different repos depending on arch #45
Workflow file for this run
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
# When a new release is published, | |
# upload image to Dockerhub. | |
# | |
# Requires the following repository secrets: | |
# - DOCKER_IMAGE - Configured as a secret so it can be configured per fork. | |
# - DOCKER_HUB_USERNAME | |
# - DOCKER_HUB_ACCESS_TOKEN | |
# - GITHUBPAT - The github account to use for downloading CRAN dependencies. | |
# Needed to avoid "API rate limit exceeded" from github. | |
name: Release Docker | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
docker: | |
name: "${{ matrix.config.arch }}" | |
runs-on: ${{ matrix.config.runs_on}} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { runs_on: "ubuntu-latest", arch: "amd64"} | |
- { runs_on: "ubuntu-latest", arch: "arm64"} | |
env: | |
DOCKER_IMAGE: 'ohdsi/deep_plp' | |
steps: | |
- uses: actions/checkout@v4 | |
# Add Docker labels and tags | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DOCKER_IMAGE }} | |
tags: | | |
type=semver,pattern={{version}} | |
# Setup docker build environment | |
- name: Set up QEMU | |
if: matrix.config.arch == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set build parameters | |
id: build_params | |
run: | | |
echo "SHA8=${GITHUB_SHA::8}" >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
cache-from: type=gha | |
cache-to: type=gha, mode=max | |
file: Dockerfile | |
platforms: "linux/${{ matrix.config.arch }}" | |
push: true | |
secrets: | | |
build_github_pat=${{ secrets.GH_TOKEN }} | |
build-args: | | |
GIT_BRANCH=${{ steps.docker_meta.outputs.version }} | |
GIT_COMMIT_ID_ABBREV=${{ env.SHA8 }} | |
ARCH=${{ matrix.config.arch }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
# Use runtime labels from docker_meta as well as fixed labels | |
labels: | | |
${{ steps.docker_meta.outputs.labels }} | |
maintainer=Egill A. Fridgeirsson <[email protected]> | |
org.opencontainers.image.authors=Egill A. Fridgeirsson <[email protected]>, Henrik John <[email protected]> | |
org.opencontainers.image.vendor=OHDSI | |
org.opencontainers.image.licenses=Apache-2.0 | |
- name: Inspect image | |
run: | | |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} | |
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} |