Skip to content

Commit 7c83502

Browse files
authored
Refactoring logic and intro Github Actions (#26)
* Refactoring logic - Modify all dockerfile files, unified replacement logic - Fix `perl` required error. - Add ignore file - Fix CentOS 5 support, by change mirror from `http://archive.kernel.org` to `http://linuxsoft.cern.ch` * Update README.md - Add a short usage for docker * Create Github Actions - Add `build-images.yml` to auto build docker images. Support: CentOS 7/6/5, CentOS Stream 8/9, Amazon Linux 1/2/2023. - Add `create-amd64-release.yml` to auto create amd64 release files. - Add `create-arm64-release.yml` to auto create arm64 release files. - Reformat release comment Features: - Using batch build and batch compile - Using latest action version
1 parent 22c93f5 commit 7c83502

10 files changed

+909
-68
lines changed

.github/workflows/build-images.yml

+341
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build Docker Images
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "main" branch
8+
push:
9+
branches: [ "main" ]
10+
pull_request:
11+
branches: [ "main" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
build_and_push_al2023:
19+
# The type of runner that the job will run on
20+
runs-on: ubuntu-latest
21+
22+
env:
23+
CHINA_MIRROR: "0"
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to Docker Hub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKER_USERNAME }}
38+
password: ${{ secrets.DOCKER_PASSWORD }}
39+
40+
- name: Set up QEMU
41+
uses: docker/setup-qemu-action@v3
42+
43+
- name: Build and push Amazon Linux 2023
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
file: ./docker/Dockerfile.amazonlinux
48+
platforms: linux/amd64,linux/arm64
49+
push: true
50+
tags: |
51+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2023,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al2023
52+
build-args: |
53+
VERSION_NUM=2023
54+
55+
- name: Log out from Docker Hub
56+
run: docker logout
57+
58+
build_and_push_al2:
59+
# The type of runner that the job will run on
60+
runs-on: ubuntu-latest
61+
62+
env:
63+
CHINA_MIRROR: "0"
64+
65+
# Steps represent a sequence of tasks that will be executed as part of the job
66+
steps:
67+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Log in to Docker Hub
75+
uses: docker/login-action@v3
76+
with:
77+
username: ${{ secrets.DOCKER_USERNAME }}
78+
password: ${{ secrets.DOCKER_PASSWORD }}
79+
80+
- name: Set up QEMU
81+
uses: docker/setup-qemu-action@v3
82+
83+
- name: Build and push Amazon Linux 2
84+
uses: docker/build-push-action@v6
85+
with:
86+
context: .
87+
file: ./docker/Dockerfile.amazonlinux
88+
platforms: linux/amd64,linux/arm64
89+
push: true
90+
tags: |
91+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al2
92+
build-args: |
93+
VERSION_NUM=2
94+
95+
- name: Log out from Docker Hub
96+
run: docker logout
97+
98+
build_and_push_al1:
99+
# The type of runner that the job will run on
100+
runs-on: ubuntu-latest
101+
102+
env:
103+
CHINA_MIRROR: "0"
104+
105+
# Steps represent a sequence of tasks that will be executed as part of the job
106+
steps:
107+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Set up Docker Buildx
112+
uses: docker/setup-buildx-action@v3
113+
114+
- name: Log in to Docker Hub
115+
uses: docker/login-action@v3
116+
with:
117+
username: ${{ secrets.DOCKER_USERNAME }}
118+
password: ${{ secrets.DOCKER_PASSWORD }}
119+
120+
- name: Set up QEMU
121+
uses: docker/setup-qemu-action@v3
122+
123+
- name: Build and push Amazon Linux 1
124+
uses: docker/build-push-action@v6
125+
with:
126+
context: .
127+
file: ./docker/Dockerfile.amazonlinux
128+
platforms: linux/amd64
129+
push: true
130+
tags: |
131+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux1,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al1
132+
build-args: |
133+
VERSION_NUM=1
134+
135+
- name: Log out from Docker Hub
136+
run: docker logout
137+
138+
build_and_push_el9:
139+
# The type of runner that the job will run on
140+
runs-on: ubuntu-latest
141+
142+
env:
143+
CHINA_MIRROR: "0"
144+
145+
# Steps represent a sequence of tasks that will be executed as part of the job
146+
steps:
147+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
148+
- name: Checkout code
149+
uses: actions/checkout@v4
150+
151+
- name: Set up Docker Buildx
152+
uses: docker/setup-buildx-action@v3
153+
154+
- name: Log in to Docker Hub
155+
uses: docker/login-action@v3
156+
with:
157+
username: ${{ secrets.DOCKER_USERNAME }}
158+
password: ${{ secrets.DOCKER_PASSWORD }}
159+
160+
- name: Set up QEMU
161+
uses: docker/setup-qemu-action@v3
162+
163+
- name: Build and push CentOS Stream 9
164+
uses: docker/build-push-action@v6
165+
with:
166+
context: .
167+
file: ./docker/Dockerfile.centos-stream
168+
platforms: linux/amd64,linux/arm64
169+
push: true
170+
tags: |
171+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream9,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el9
172+
build-args: |
173+
VERSION_NUM=9
174+
175+
- name: Log out from Docker Hub
176+
run: docker logout
177+
178+
build_and_push_el8:
179+
# The type of runner that the job will run on
180+
runs-on: ubuntu-latest
181+
182+
env:
183+
CHINA_MIRROR: "0"
184+
185+
# Steps represent a sequence of tasks that will be executed as part of the job
186+
steps:
187+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
188+
- name: Checkout code
189+
uses: actions/checkout@v4
190+
191+
- name: Set up Docker Buildx
192+
uses: docker/setup-buildx-action@v3
193+
194+
- name: Log in to Docker Hub
195+
uses: docker/login-action@v3
196+
with:
197+
username: ${{ secrets.DOCKER_USERNAME }}
198+
password: ${{ secrets.DOCKER_PASSWORD }}
199+
200+
- name: Set up QEMU
201+
uses: docker/setup-qemu-action@v3
202+
203+
- name: Build and push CentOS Stream 8
204+
uses: docker/build-push-action@v6
205+
with:
206+
context: .
207+
file: ./docker/Dockerfile.centos-stream
208+
platforms: linux/amd64,linux/arm64
209+
push: true
210+
tags: |
211+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream8,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el8
212+
build-args: |
213+
VERSION_NUM=8
214+
215+
- name: Log out from Docker Hub
216+
run: docker logout
217+
218+
219+
build_and_push_el7:
220+
# The type of runner that the job will run on
221+
runs-on: ubuntu-latest
222+
223+
env:
224+
CHINA_MIRROR: "0"
225+
226+
# Steps represent a sequence of tasks that will be executed as part of the job
227+
steps:
228+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
229+
- name: Checkout code
230+
uses: actions/checkout@v4
231+
232+
- name: Set up Docker Buildx
233+
uses: docker/setup-buildx-action@v3
234+
235+
- name: Log in to Docker Hub
236+
uses: docker/login-action@v3
237+
with:
238+
username: ${{ secrets.DOCKER_USERNAME }}
239+
password: ${{ secrets.DOCKER_PASSWORD }}
240+
241+
- name: Set up QEMU
242+
uses: docker/setup-qemu-action@v3
243+
244+
- name: Build and push CentOS 7
245+
uses: docker/build-push-action@v6
246+
with:
247+
context: .
248+
file: ./docker/Dockerfile.centos
249+
platforms: linux/amd64,linux/arm64
250+
push: true
251+
tags: |
252+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos7,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el7
253+
build-args: |
254+
VERSION_NUM=7
255+
256+
- name: Log out from Docker Hub
257+
run: docker logout
258+
259+
260+
build_and_push_el6:
261+
# The type of runner that the job will run on
262+
runs-on: ubuntu-latest
263+
264+
env:
265+
CHINA_MIRROR: "0"
266+
267+
# Steps represent a sequence of tasks that will be executed as part of the job
268+
steps:
269+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
270+
- name: Checkout code
271+
uses: actions/checkout@v4
272+
273+
- name: Set up Docker Buildx
274+
uses: docker/setup-buildx-action@v3
275+
276+
- name: Log in to Docker Hub
277+
uses: docker/login-action@v3
278+
with:
279+
username: ${{ secrets.DOCKER_USERNAME }}
280+
password: ${{ secrets.DOCKER_PASSWORD }}
281+
282+
- name: Set up QEMU
283+
uses: docker/setup-qemu-action@v3
284+
285+
- name: Build and push CentOS 6
286+
uses: docker/build-push-action@v6
287+
with:
288+
context: .
289+
file: ./docker/Dockerfile.centos
290+
platforms: linux/amd64
291+
push: true
292+
tags: |
293+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos6,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el6
294+
build-args: |
295+
VERSION_NUM=6
296+
297+
- name: Log out from Docker Hub
298+
run: docker logout
299+
300+
build_and_push_el5:
301+
# The type of runner that the job will run on
302+
runs-on: ubuntu-latest
303+
304+
# Set this to prevents a workflow run from failing when this job fail.
305+
continue-on-error: true
306+
307+
env:
308+
CHINA_MIRROR: "0"
309+
310+
# Steps represent a sequence of tasks that will be executed as part of the job
311+
steps:
312+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
313+
- name: Checkout code
314+
uses: actions/checkout@v4
315+
316+
- name: Set up Docker Buildx
317+
uses: docker/setup-buildx-action@v3
318+
319+
- name: Log in to Docker Hub
320+
uses: docker/login-action@v3
321+
with:
322+
username: ${{ secrets.DOCKER_USERNAME }}
323+
password: ${{ secrets.DOCKER_PASSWORD }}
324+
325+
- name: Set up QEMU
326+
uses: docker/setup-qemu-action@v3
327+
328+
- name: Build and push CentOS 5
329+
uses: docker/build-push-action@v6
330+
with:
331+
context: .
332+
file: ./docker/Dockerfile.centos
333+
platforms: linux/amd64
334+
push: true
335+
tags: |
336+
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos5,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el5
337+
build-args: |
338+
VERSION_NUM=5
339+
340+
- name: Log out from Docker Hub
341+
run: docker logout

0 commit comments

Comments
 (0)