Skip to content

Commit baba032

Browse files
committed
feat: add schedule docker package
1 parent 32c8818 commit baba032

File tree

4 files changed

+120
-30
lines changed

4 files changed

+120
-30
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: build app base
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Why trigger?"
8+
required: true
9+
type: string
10+
11+
env:
12+
IMAGE: "deepflow-app"
13+
14+
jobs:
15+
build_app_base_amd64:
16+
runs-on: "ubuntu-latest"
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
submodules: recursive
22+
fetch-depth: 0
23+
24+
- name: docker version
25+
run: |
26+
docker version
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
with:
31+
install: true
32+
33+
- name: Log in to GitHub Docker Registry
34+
uses: docker/login-action@v2
35+
with:
36+
registry: "ghcr.io"
37+
username: "${{ github.repository_owner }}"
38+
password: "${{ secrets.GITHUB_TOKEN }}"
39+
40+
- name: Build and push deepflow app base builder images
41+
uses: docker/build-push-action@v3
42+
with:
43+
context: app
44+
push: true
45+
file: app/Dockerfile_base
46+
platforms: linux/amd64
47+
tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-base-amd64
48+
49+
build_app_base_arm64:
50+
#runs-on: "cirun-aws-arm64-32c--${{ github.run_id }}"
51+
runs-on: "ubuntu-latest"
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v3
55+
with:
56+
submodules: recursive
57+
fetch-depth: 0
58+
59+
- name: docker version
60+
run: |
61+
docker version
62+
63+
- name: Set up Docker Buildx
64+
uses: docker/setup-buildx-action@v3
65+
with:
66+
install: true
67+
68+
- name: Log in to GitHub Docker Registry
69+
uses: docker/login-action@v2
70+
with:
71+
registry: "ghcr.io"
72+
username: "${{ github.repository_owner }}"
73+
password: "${{ secrets.GITHUB_TOKEN }}"
74+
75+
- name: Build and push deepflow app base builder images
76+
uses: docker/build-push-action@v3
77+
with:
78+
context: app
79+
push: true
80+
file: app/Dockerfile_base
81+
platforms: linux/arm64
82+
tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-base-arm64

.github/workflows/app-build.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
docker version
4545
4646
- name: Set up Docker Buildx
47-
uses: docker/setup-buildx-action@v2
47+
uses: docker/setup-buildx-action@v3
4848
with:
4949
install: true
5050

@@ -56,15 +56,19 @@ jobs:
5656
password: "${{ secrets.GITHUB_TOKEN }}"
5757

5858
- name: Build and push deepflow app images
59-
uses: docker/build-push-action@v2
59+
uses: docker/build-push-action@v3
6060
with:
6161
context: app
6262
push: false
6363
file: app/Dockerfile_depends
6464
platforms: linux/amd64
6565
outputs: type=local,dest=./app/output_amd64
66+
# tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-amd64
6667
cache-from: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-amd64
6768
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-amd64
69+
build-args: |
70+
OWNER=${{ github.repository_owner }}
71+
IMAGE=${{ env.IMAGE }}
6872
6973
- name: Package code build results
7074
run: |
@@ -97,7 +101,7 @@ jobs:
97101
docker version
98102
99103
- name: Set up Docker Buildx
100-
uses: docker/setup-buildx-action@v2
104+
uses: docker/setup-buildx-action@v3
101105
with:
102106
install: true
103107

@@ -109,15 +113,19 @@ jobs:
109113
password: "${{ secrets.GITHUB_TOKEN }}"
110114

111115
- name: Build and push deepflow app images
112-
uses: docker/build-push-action@v2
116+
uses: docker/build-push-action@v3
113117
with:
114118
context: app
115119
push: false
116120
file: app/Dockerfile_depends
117121
platforms: linux/arm64
118122
outputs: type=local,dest=./app/output_arm64
123+
# tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-arm64
119124
cache-from: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-arm64
120125
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:main-cache-arm64
126+
build-args: |
127+
OWNER=${{ github.repository_owner }}
128+
IMAGE=${{ env.IMAGE }}
121129
122130
- name: Package code build results
123131
run: |
@@ -154,7 +162,7 @@ jobs:
154162
docker version
155163
156164
- name: Set up Docker Buildx
157-
uses: docker/setup-buildx-action@v2
165+
uses: docker/setup-buildx-action@v3
158166
with:
159167
install: true
160168

@@ -207,7 +215,7 @@ jobs:
207215
208216
209217
- name: Build and push deepflow app images
210-
uses: docker/build-push-action@v2
218+
uses: docker/build-push-action@v3
211219
with:
212220
context: app
213221
push: true
@@ -219,7 +227,7 @@ jobs:
219227
"deepflowce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}"
220228
221229
- name: Build and push deepflow app images to hongkong aliyun
222-
uses: docker/build-push-action@v2
230+
uses: docker/build-push-action@v3
223231
with:
224232
context: app
225233
push: true
@@ -237,7 +245,7 @@ jobs:
237245
password: "${{ secrets.REGISTRY_PASS }}"
238246

239247
- name: Build and push deepflow app images to beijing aliyun
240-
uses: docker/build-push-action@v2
248+
uses: docker/build-push-action@v3
241249
with:
242250
context: app
243251
push: true

app/Dockerfile_base

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 构建层
2+
FROM python:3.8-alpine AS builder
3+
RUN apk update && \
4+
apk upgrade && \
5+
apk add --no-cache \
6+
gcc \
7+
g++ \
8+
libc-dev \
9+
python3-dev \
10+
libpq-dev \
11+
mariadb-connector-c-dev \
12+
libffi-dev \
13+
make \
14+
&& \
15+
pip install --upgrade pip
16+
17+
RUN pip install cffi

app/Dockerfile_depends

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
# 构建层
2-
FROM python:3.8-alpine AS builder
3-
RUN apk update && \
4-
apk upgrade && \
5-
apk add --no-cache \
6-
gcc \
7-
g++ \
8-
libc-dev \
9-
python3-dev \
10-
libpq-dev \
11-
mariadb-connector-c-dev \
12-
libffi-dev \
13-
make \
14-
&& \
15-
pip install --upgrade pip
16-
17-
# Base 构建层
18-
FROM builder AS builder-base
19-
RUN pip install cffi
20-
211
# 自定义构建层
22-
FROM builder-base AS builder-custom
2+
ARG OWNER
3+
ARG IMAGE
4+
ARG TARGETARCH
5+
FROM ghcr.io/$OWNER/$IMAGE:main-base-$TARGETARCH AS builder-custom
6+
# FROM builder-base AS builder-custom
237
RUN pip install --user --disable-pip-version-check \
248
--no-cache-dir \
259
aiofiles==23.2.1 aiohttp==3.10.11 aiosignal==1.3.1 async-timeout==4.0.3 attrs==23.1.0 \
@@ -33,4 +17,3 @@ RUN pip install --user --disable-pip-version-check \
3317
yarl==1.12.1 zipp==3.19.2
3418
FROM scratch
3519
COPY --from=builder-custom /root/.local /
36-

0 commit comments

Comments
 (0)