-
Notifications
You must be signed in to change notification settings - Fork 342
149 lines (144 loc) · 5.06 KB
/
Copy pathbuild_image.yml
File metadata and controls
149 lines (144 loc) · 5.06 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Publish Official flytekit Images
on:
workflow_dispatch:
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Get version from branch/tag name
id: version
run: |
REF_NAME="${GITHUB_REF_NAME}"
# If ref starts with 'v' followed by a digit (e.g. v1.16.17), strip 'v' to get the PyPI version
if [[ "$REF_NAME" =~ ^v[0-9] ]]; then
VERSION="${REF_NAME#v}"
else
echo "::error::This workflow must be run from a version tag or branch (e.g. v1.16.17), got '$REF_NAME'"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
shell: bash
build-and-push-docker-images-manual:
runs-on: ubuntu-latest
needs: get-version
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Flytekit Image Names
id: flytekit-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
py${{ matrix.python-version }}-${{ github.sha }}
py${{ matrix.python-version }}-${{ needs.get-version.outputs.version }}
- name: Build & Push Flytekit Python${{ matrix.python-version }} Docker Image to Github Registry
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/arm64, linux/amd64
push: true
tags: ${{ steps.flytekit-names.outputs.tags }}
build-args: |
VERSION=${{ needs.get-version.outputs.version }}
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/flytekit:py${{ matrix.python-version }}-${{ needs.get-version.outputs.version }}
PYTHON_VERSION=${{ matrix.python-version }}
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-flyteagent-images-manual:
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Flyte Agent Image Names
id: flyteagent-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flyteagent
tags: |
${{ github.sha }}
${{ needs.get-version.outputs.version }}
- name: Push External Plugin Service Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "."
platforms: linux/arm64, linux/amd64
push: true
tags: ${{ steps.flyteagent-names.outputs.tags }}
build-args: |
VERSION=${{ needs.get-version.outputs.version }}
file: ./Dockerfile.connector
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-flyteconnector-images-manual:
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Flyte Connector Image Names
id: flyteconnector-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flyteconnector
tags: |
${{ github.sha }}
${{ needs.get-version.outputs.version }}
- name: Push External Plugin Service Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "."
platforms: linux/arm64, linux/amd64
push: true
tags: ${{ steps.flyteconnector-names.outputs.tags }}
build-args: |
VERSION=${{ needs.get-version.outputs.version }}
file: ./Dockerfile.connector
cache-from: type=gha
cache-to: type=gha,mode=max