-
Notifications
You must be signed in to change notification settings - Fork 26
86 lines (76 loc) · 2.57 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build and upload Docker Image
on:
pull_request:
branches: ["releases/**"]
types: [labeled, opened, synchronize, reopened]
workflow_run:
workflows: [Build Wheels and upload to PyPI]
types: [completed]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
docker_build:
name: Build the Docker Image
# Build docker image on one of two conditions:
# 1. `pypi_publish` workflow runs to completion and succeeds, and the job was triggered by a new release.
# 2. A dev manually dispatched the Build workflow for testing in a releases/X.Y.Z pull request.
if: |
(
${{ github.event.workflow_run.conclusion == 'success'}}
&&
${{ github.event_name == 'release' && github.event.action == 'published' }}
)
||
(
${{ github.event_name == 'workflow_dispatch' }}
)
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
fetch-depth: 0
# Checkout the latest release branch
ref: ${{ github.event.workflow_run.head_sha }}
- name: Set up QEMU (For Linux Arm Containers)
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
# Uses the latest version of Buildx and Buildkit
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Metadata Information
uses: docker/metadata-action@v5
id: docker_metadata
with:
github-token: ${{ github.token }}
images: |
${{ secrets.DOCKERHUB_USERNAME }}/ark-analysis
flavor: |
latest=auto
tags: |
type=ref,event=branch,pattern={{raw}}
type=ref,event=pr,pattern={{raw}}
type=semver,pattern={{raw}}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
cache-to: type=gha,mode=max
cache-from: type=gha