-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (89 loc) · 3.11 KB
/
ingress.yaml
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
name: ingress
permissions:
contents: read
on:
push:
branches: [ ingress ]
workflow_dispatch:
inputs:
script_version:
description: 'script version, only support 1.9 or 0.49'
required: true
default: '1.9'
branch:
description: 'branch or tag name, should compatibe with SCRIPT_VERSION'
required: true
default: 'release-1.9'
arch:
description: 'arch'
required: true
default: 'amd64'
env:
PROJECT: ingress-nginx
BRANCH: release-1.9 # NOTICE, SCRIPT_VERSION must comtible
ARCH: amd64
SCRIPT_VERSION: 1.9
REGISTRY_NAME: "docker.io"
REGISTRY_USER: "${{ secrets.DOCKER_HUB_USER }}"
REGISTRY_PASS: "${{ secrets.DOCKER_HUB_PASSWORD }}"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setting
run: |
set -x
if ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
echo "SCRIPT_VERSION=${{ github.event.inputs.script_version }}" >> $GITHUB_ENV
echo "ARCH=${{ github.event.inputs.arch }}" >> $GITHUB_ENV
fi
echo "trigger by ${{ github.event_name }}"
echo "BRANCH is ${{ env.BRANCH }}"
echo "SCRIPT_VERSION is ${{ env.SCRIPT_VERSION }}"
echo "ARCH is ${{ env.ARCH }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out repo code
uses: actions/checkout@v4
- name: Check out build code
uses: actions/checkout@v4
with:
repository: easystack/${{ env.PROJECT }}
ref: ${{ env.BRANCH }}
token: ${{ secrets.KPULL }}
path: ${{ env.PROJECT }}
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY_NAME }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}
- name: Image Build And Push
shell: bash
run: |
set -ex
# 覆盖默认build.sh, 支持 sm 密码 ssl 库
cp -f ingress/build-${{ env.SCRIPT_VERSION }}.sh ${{ env.PROJECT }}/images/nginx/rootfs/build.sh
# 删除 openssl 相关
sed -i '/openssl/d' ${{ env.PROJECT }}/images/nginx/rootfs/Dockerfile
# build
cd ${{ env.PROJECT }}
export REGISTRY=${{ env.REGISTRY_NAME }}/yylt
export BASE_IMAGE=${{ env.REGISTRY_NAME }}/yylt/ingress:${{ env.ARCH }}-base-${{ env.SCRIPT_VERSION }}
# base base image
docker buildx build \
--no-cache \
--platform linux/${{ env.ARCH }} \
--output "type=image,push=true" \
--tag ${BASE_IMAGE} \
--file ./images/nginx/rootfs/Dockerfile ./images/nginx/rootfs
# build ingress image
export ARCH=${{ env.ARCH }}
export PLATFORM=linux/${{ env.ARCH }}
make build && make image
docker tag ${REGISTRY}/controller:$(cat TAG) ${REGISTRY}/ingress:${ARCH}-${{ env.SCRIPT_VERSION }}
docker push ${REGISTRY}/ingress:${ARCH}-${{ env.SCRIPT_VERSION }}