-
Notifications
You must be signed in to change notification settings - Fork 13
81 lines (77 loc) · 2.92 KB
/
release_docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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:
release:
types: [published]
workflow_dispatch:
inputs:
docker_image:
description: 'Override the name of the image to be deployed.'
default: 'ohdsi/hades'
type: string
jobs:
docker:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: ${{ inputs.docker_image || secrets.DOCKER_IMAGE }}
steps:
- uses: actions/checkout@v2
# ------------------------------------
# The pattern for the following steps is specified
# in OHDSI/WebAPI.
# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ env.DOCKER_IMAGE }}
tag-match: v(.*)
tag-match-group: 1
# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set build parameters
id: build_params
run: |
echo "::set-output name=sha8::${GITHUB_SHA::8}"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
# Allow running the image on the architectures supported by nginx-unprivileged:alpine.
platforms: linux/amd64,linux/arm64
push: true
secrets: |
build_github_pat=${{ secrets.GITHUBPAT }}
build-args: |
GIT_BRANCH=${{ steps.docker_meta.outputs.version }}
GIT_COMMIT_ID_ABBREV=${{ steps.build_params.outputs.sha8 }}
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
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 }}