Merge pull request #322 from pymumu/master #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI Tencent Cloud | |
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 ccr.ccs.tencentyun.com --username=${{ secrets.CCR_USERNAME }} --password='${{ secrets.CCR_PASSWORD }}' | |
docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push -t ccr.ccs.tencentyun.com/pikuzheng/smartdns:latest -t ccr.ccs.tencentyun.com/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 ccr.ccs.tencentyun.com/pikuzheng/smartdns:check-edns -f Dockerfile.alpine . | |