forked from pymumu/smartdns
-
Notifications
You must be signed in to change notification settings - Fork 11
62 lines (59 loc) · 2.42 KB
/
deploy-docker.yml
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
name: Docker Image CI
on:
workflow_dispatch:
push:
branches:
- master
jobs:
# 构建并上传 Docker镜像
build:
runs-on: ubuntu-latest # 依赖的环境
steps:
- uses: actions/checkout@v3
with:
ref: VERSION_CONTROL
fetch-depth: 1
path: version_control
- name: get version
id: get-version
run: |
#获取当前版本号
pre_version=$(cat version_control/VERSION | grep "PREFEX" | sed 's/PREFEX=\(.*\)/\1/')
cur_version=$(cat version_control/VERSION | grep "CUR_VERS" | sed 's/CUR_VERS=\(.*\)/\1/')
echo "CUR_VERSION=$pre_version$cur_version" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
- uses: docker/setup-buildx-action@v2
with:
install: true
- name: Build Image
run: |
#修改版本号
cd ${{ github.workspace }}
sed -i "s/VER=.*/VER=${{steps.get-version.outputs.CUR_VERSION}}/" package/build-pkg.sh
#构建image
docker login --username=${{ secrets.DOCKER_USERNAME }} --password='${{ secrets.DOCKER_PASSWORD }}'
docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -t pikuzheng/smartdns:latest -t pikuzheng/smartdns:${{steps.get-version.outputs.CUR_VERSION}} -f Dockerfile.alpine .
#增加 check-edns分支
cat >> Makefile.patch << EOF
--- Makefile
+++ Makefile
@@ -27,6 +27,7 @@
ifdef VER
override CFLAGS += -DSMARTDNS_VERION='"\$(VER)"'
endif
+override CFLAGS += -DFEATURE_CHECK_EDNS
CXXFLAGS=-O2 -g -Wall -std=c++11
override CXXFLAGS +=-Iinclude
EOF
patch -p0 ./src/Makefile Makefile.patch
docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -t pikuzheng/smartdns:check-edns -f Dockerfile.alpine .
# - name: Login to Registry
# run: |
# docker login --username=${{ secrets.DOCKER_USERNAME }} --password='${{ secrets.DOCKER_PASSWORD }}'
# - name: Push Image
# run: |
# docker push pikuzheng/smartdns:latest
# docker push pikuzheng/smartdns:${{steps.get-version.outputs.CUR_VERSION}}