-
Notifications
You must be signed in to change notification settings - Fork 2
202 lines (178 loc) · 7.43 KB
/
appflowy_search_docker.yml
File metadata and controls
202 lines (178 loc) · 7.43 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Self-Hosted AppFlowy Search Docker Image
run-name: Build AppFlowy Search ${{ github.event.inputs.custom_tag }} - Push ${{ github.event.inputs.push_appflowy_search == 'true' && '🔍' || '' }} ${{ github.event.inputs.tag_latest == 'true' && 'latest' || '' }}
on:
workflow_dispatch:
inputs:
appflowy_cloud_branch:
description: "AppFlowy Cloud branch (from AppFlowy-Cloud-Premium)"
required: true
default: "main"
custom_tag:
description: "Custom tag to use. Example: 0.9.8"
required: true
default: ""
push_appflowy_search:
description: "Push AppFlowy Search image to registry"
type: boolean
required: false
default: false
build_arm64:
description: "Also build ARM64 images (AMD64 always built)"
type: boolean
required: false
default: true
tag_latest:
description: "Also tag and publish 'latest'"
type: boolean
required: false
default: true
env:
LATEST_TAG: latest
RUST_TOOLCHAIN: "1.86.0"
SQLX_OFFLINE: true
jobs:
appflowy_search_image:
runs-on: ${{ matrix.job.os }}
env:
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search
strategy:
fail-fast: true
matrix:
job: ${{ fromJson(github.event.inputs.build_arm64 == 'true' && '[{"os":"ubuntu-22.04","name":"amd64","docker_platform":"linux/amd64"},{"os":"ubuntu-22.04-arm","name":"arm64v8","docker_platform":"linux/arm64"}]' || '[{"os":"ubuntu-22.04","name":"amd64","docker_platform":"linux/amd64"}]') }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
repository: AppFlowy-IO/AppFlowy-Cloud-Premium
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
ref: ${{ github.event.inputs.appflowy_cloud_branch }}
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.custom_tag }}"
echo "GIT_TAG=$T" >> $GITHUB_ENV
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: registry.hub.docker.com/${{ env.IMAGE_NAME }}
- name: Build and save ${{ matrix.job.name }}:${{ env.GIT_TAG }}
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.job.docker_platform }}
file: ./services/appflowy-search/Dockerfile
push: false
load: true
cache-from: type=gha,scope=appflowy_search-${{ matrix.job.name }}
cache-to: type=gha,mode=max,scope=appflowy_search-${{ matrix.job.name }}
tags: |
${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
build-args: |
PROFILE=release
APP_VERSION=${{ env.GIT_TAG }}
- name: Save AppFlowy Search image locally
run: |
mkdir -p /tmp/docker-images
docker save ${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} | gzip > /tmp/docker-images/appflowy_search_${{ matrix.job.name }}.tar.gz
docker save ${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} | gzip > /tmp/docker-images/appflowy_search_latest_${{ matrix.job.name }}.tar.gz
- name: Upload AppFlowy Search image as artifact
uses: actions/upload-artifact@v4
with:
name: appflowy-search-image-${{ matrix.job.name }}
path: /tmp/docker-images/appflowy_search_*.tar.gz
retention-days: 1
- name: Logout from Docker Hub
if: always()
run: docker logout
appflowy_search_push:
runs-on: ubuntu-22.04
if: ${{ github.event.inputs.push_appflowy_search == 'true' }}
needs: [appflowy_search_image]
env:
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search
strategy:
fail-fast: true
matrix:
job: ${{ fromJson(github.event.inputs.build_arm64 == 'true' && '[{"name":"amd64"},{"name":"arm64v8"}]' || '[{"name":"amd64"}]') }}
steps:
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.custom_tag }}"
echo "GIT_TAG=$T" >> $GITHUB_ENV
- name: Download AppFlowy Search image
uses: actions/download-artifact@v4
with:
name: appflowy-search-image-${{ matrix.job.name }}
path: /tmp/docker-images
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Load and Push AppFlowy Search
run: |
docker load < /tmp/docker-images/appflowy_search_${{ matrix.job.name }}.tar.gz
docker load < /tmp/docker-images/appflowy_search_latest_${{ matrix.job.name }}.tar.gz || true
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
docker push ${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
fi
docker push ${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
- name: Logout from Docker Hub
if: always()
run: docker logout
appflowy_search_manifest:
runs-on: ubuntu-22.04
if: ${{ github.event.inputs.push_appflowy_search == 'true' }}
needs: [appflowy_search_push]
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.custom_tag }}"
echo "GIT_TAG=$T" >> $GITHUB_ENV
- name: Create and push manifest for appflowy_search:version
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.GIT_TAG }}
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.GIT_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_search:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.GIT_TAG) || '' }}
push: true
- name: Create and push manifest for appflowy_search:latest
if: ${{ github.event.inputs.tag_latest == 'true' }}
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.LATEST_TAG }}
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.LATEST_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_search:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.LATEST_TAG) || '' }}
push: true
- name: Logout from Docker Hub
if: always()
run: docker logout
cleanup_artifacts:
runs-on: ubuntu-22.04
if: always()
needs: [appflowy_search_manifest]
steps:
- name: Delete AppFlowy Search artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
appflowy-search-image-amd64
appflowy-search-image-arm64v8
failOnError: false
- name: Cleanup summary
run: |
echo "✅ Artifact cleanup completed"