-
Notifications
You must be signed in to change notification settings - Fork 26
58 lines (55 loc) · 1.88 KB
/
docker.yml
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
# This workflow builds and pushes the docker image using docker's v2 action
# which requires explicitly setting up buildx and logging in
name: Build and publish container to Docker Hub
on:
push:
tags: ['^v\d+\.\d+\.\d+$'] # Match tags that resemble a version, but exclude minior releases. For example, v0.1.1-beta would not get included
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_ORG: sagebionetworks
DOCKER_REPO: schematic
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
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: schematicbot
password: ${{ secrets.DOCKER_HUB_TOKEN }}
-
name: Compute short commit SHA ID
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
-
name: Build and push (tagged release)
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'push' }}
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:latest
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ github.ref_name }}
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:commit-${{ steps.vars.outputs.sha_short }}
-
name: Build and push (manual release)
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:commit-${{ steps.vars.outputs.sha_short }}