forked from polakowo/vectorbt
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (96 loc) · 2.88 KB
/
Copy pathdocker.yml
File metadata and controls
109 lines (96 loc) · 2.88 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Docker
on:
workflow_call:
inputs:
ref:
required: false
type: string
version:
required: false
type: string
prerelease:
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
ref:
description: "Git ref to build. Defaults to the workflow ref."
required: false
type: string
version:
description: "Semver tag to publish, such as v1.1.0. Optional for tag-triggered runs."
required: false
type: string
prerelease:
description: "Skip latest tags."
required: false
type: boolean
default: false
permissions:
contents: read
env:
IMAGE_NAME: vectorbt
jobs:
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- variant: base
vbt_extras: ""
tag_suffix: ""
latest_tag: latest
- variant: rust
vbt_extras: "rust"
tag_suffix: "-rust"
latest_tag: latest-rust
- variant: full
vbt_extras: "full"
tag_suffix: "-full"
latest_tag: latest-full
- variant: full-rust
vbt_extras: "full,rust"
tag_suffix: "-full-rust"
latest_tag: latest-full-rust
steps:
- name: Checkout release tag
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
fetch-depth: 1
fetch-tags: true
filter: blob:none
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) - ${{ matrix.variant }}
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}${{ matrix.tag_suffix }}
type=semver,pattern={{version}}${{ matrix.tag_suffix }},value=${{ inputs.version }},enable=${{ inputs.version != '' }}
type=raw,value=${{ matrix.latest_tag }},enable=${{ !inputs.prerelease }}
- name: Build and push (multi-arch) - ${{ matrix.variant }}
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VBT_EXTRAS=${{ matrix.vbt_extras }}
cache-from: type=gha
cache-to: type=gha,mode=max