Skip to content

Commit 99b47c3

Browse files
committed
chore: extract docker flow to separate workflow
1 parent b17dff4 commit 99b47c3

File tree

2 files changed

+139
-131
lines changed

2 files changed

+139
-131
lines changed

.github/workflows/ci.yml

+6-131
Original file line numberDiff line numberDiff line change
@@ -93,135 +93,10 @@ jobs:
9393
with:
9494
asset_paths: '["./freqUI.zip"]'
9595

96-
97-
docker:
98-
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/frequi'
96+
call-docker-workflow:
9997
needs: build
100-
runs-on: ubuntu-latest
101-
102-
permissions:
103-
packages: write
104-
105-
environment:
106-
name: Production
107-
strategy:
108-
fail-fast: false
109-
matrix:
110-
platform:
111-
- linux/amd64
112-
- linux/arm/v6
113-
- linux/arm/v7
114-
- linux/arm64
115-
116-
steps:
117-
118-
- uses: actions/checkout@v4
119-
120-
- name: Prepare Platform_pair
121-
run: |
122-
platform=${{ matrix.platform }}
123-
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
124-
125-
- name: Set up QEMU
126-
uses: docker/setup-qemu-action@v3
127-
128-
- name: Set up Docker Buildx
129-
uses: docker/setup-buildx-action@v3
130-
131-
- name: Login to Docker Hub
132-
uses: docker/login-action@v3
133-
with:
134-
username: ${{ secrets.DOCKERHUB_USERNAME }}
135-
password: ${{ secrets.DOCKERHUB_TOKEN }}
136-
137-
138-
- name: Download digests
139-
uses: actions/download-artifact@v4
140-
with:
141-
path: ./dist/
142-
# Use node-22 build.
143-
name: freqUI-22
144-
145-
146-
- name: Build and push Docker image
147-
id: build
148-
uses: docker/build-push-action@v6
149-
with:
150-
platforms: ${{ matrix.platform }}
151-
context: .
152-
file: ./docker/Dockerfile
153-
tags: ${{ steps.meta.outputs.tags }}
154-
outputs: type=image,name=freqtradeorg/frequi,push-by-digest=true,name-canonical=true,push=true
155-
156-
157-
- name: Export digest
158-
run: |
159-
mkdir -p /tmp/digests
160-
digest="${{ steps.build.outputs.digest }}"
161-
touch "/tmp/digests/${digest#sha256:}"
162-
163-
- name: Upload digest
164-
uses: actions/upload-artifact@v4
165-
with:
166-
name: digests-${{ env.PLATFORM_PAIR }}
167-
path: /tmp/digests/*
168-
if-no-files-found: error
169-
retention-days: 1
170-
171-
docker-merge:
172-
runs-on: ubuntu-latest
173-
needs:
174-
- docker
175-
environment:
176-
name: Production
177-
178-
permissions:
179-
packages: write
180-
181-
steps:
182-
- name: Download digests
183-
uses: actions/download-artifact@v4
184-
with:
185-
path: /tmp/digests
186-
pattern: digests-*
187-
merge-multiple: true
188-
189-
- name: Set up Docker Buildx
190-
uses: docker/setup-buildx-action@v3
191-
192-
- name: Docker meta
193-
id: meta
194-
uses: docker/metadata-action@v5
195-
with:
196-
# list of Docker images to use as base name for tags
197-
images: |
198-
freqtradeorg/frequi
199-
ghcr.io/freqtrade/frequi
200-
# generate Docker tags based on the following events/attributes
201-
tags: |
202-
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
203-
type=semver,pattern={{version}}
204-
type=ref,event=branch
205-
206-
- name: Login to Docker Hub
207-
uses: docker/login-action@v3
208-
with:
209-
username: ${{ secrets.DOCKERHUB_USERNAME }}
210-
password: ${{ secrets.DOCKERHUB_TOKEN }}
211-
212-
- name: Login to GitHub Container Registry
213-
uses: docker/login-action@v3
214-
with:
215-
registry: ghcr.io
216-
username: ${{ github.repository_owner }}
217-
password: ${{ secrets.GITHUB_TOKEN }}
218-
219-
- name: Create manifest list and push
220-
working-directory: /tmp/digests
221-
run: |
222-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
223-
$(printf 'freqtradeorg/frequi@sha256:%s ' *)
224-
225-
- name: Inspect image
226-
run: |
227-
docker buildx imagetools inspect freqtradeorg/frequi:${{ steps.meta.outputs.version }}
98+
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/frequi'
99+
uses: ./.github/workflows/docker.yml
100+
secrets:
101+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
102+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/docker.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: FreqUI Docker Build
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
DOCKERHUB_USERNAME:
7+
required: true
8+
DOCKERHUB_TOKEN:
9+
required: true
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
environment:
17+
name: Production
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
platform:
22+
- linux/amd64
23+
- linux/arm/v6
24+
- linux/arm/v7
25+
- linux/arm64
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Prepare Platform_pair
31+
run: |
32+
platform=${{ matrix.platform }}
33+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Login to Docker Hub
42+
uses: docker/login-action@v3
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Download digests
48+
uses: actions/download-artifact@v4
49+
with:
50+
path: ./dist/
51+
# Use node-22 build.
52+
name: freqUI-22
53+
54+
- name: Build and push Docker image
55+
id: build
56+
uses: docker/build-push-action@v6
57+
with:
58+
platforms: ${{ matrix.platform }}
59+
context: .
60+
file: ./docker/Dockerfile
61+
tags: ${{ steps.meta.outputs.tags }}
62+
outputs: type=image,name=freqtradeorg/frequi,push-by-digest=true,name-canonical=true,push=true
63+
64+
- name: Export digest
65+
run: |
66+
mkdir -p /tmp/digests
67+
digest="${{ steps.build.outputs.digest }}"
68+
touch "/tmp/digests/${digest#sha256:}"
69+
70+
- name: Upload digest
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: digests-${{ env.PLATFORM_PAIR }}
74+
path: /tmp/digests/*
75+
if-no-files-found: error
76+
retention-days: 1
77+
78+
docker-merge:
79+
runs-on: ubuntu-latest
80+
needs:
81+
- docker
82+
environment:
83+
name: Production
84+
permissions:
85+
packages: write
86+
87+
steps:
88+
- name: Download digests
89+
uses: actions/download-artifact@v4
90+
with:
91+
path: /tmp/digests
92+
pattern: digests-*
93+
merge-multiple: true
94+
95+
- name: Set up Docker Buildx
96+
uses: docker/setup-buildx-action@v3
97+
98+
- name: Docker meta
99+
id: meta
100+
uses: docker/metadata-action@v5
101+
with:
102+
# list of Docker images to use as base name for tags
103+
images: |
104+
freqtradeorg/frequi
105+
ghcr.io/freqtrade/frequi
106+
# generate Docker tags based on the following events/attributes
107+
tags: |
108+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
109+
type=semver,pattern={{version}}
110+
type=ref,event=branch
111+
112+
- name: Login to Docker Hub
113+
uses: docker/login-action@v3
114+
with:
115+
username: ${{ secrets.DOCKERHUB_USERNAME }}
116+
password: ${{ secrets.DOCKERHUB_TOKEN }}
117+
118+
- name: Login to GitHub Container Registry
119+
uses: docker/login-action@v3
120+
with:
121+
registry: ghcr.io
122+
username: ${{ github.repository_owner }}
123+
password: ${{ secrets.GITHUB_TOKEN }}
124+
125+
- name: Create manifest list and push
126+
working-directory: /tmp/digests
127+
run: |
128+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
129+
$(printf 'freqtradeorg/frequi@sha256:%s ' *)
130+
131+
- name: Inspect image
132+
run: |
133+
docker buildx imagetools inspect freqtradeorg/frequi:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)