Skip to content

Merge pull request #321 from pymumu/master #323

Merge pull request #321 from pymumu/master

Merge pull request #321 from pymumu/master #323

Workflow file for this run

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}}