From 58816d7f1497eecc45135480b1c8b3880564720f Mon Sep 17 00:00:00 2001 From: LiDong Date: Tue, 9 Aug 2022 13:52:25 +0800 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit ad278aee1d1b9c9b2cd9d57a1897fd5be89e84f1 Merge: 1b616ee ba8fb1d Author: LiDong Date: Tue Aug 9 13:51:17 2022 +0800 Merge branch 'dev' of github.com:hjmcloud/hjm-certcheck into dev commit 1b616eec6136c83cab5ec1382ddcc3894818a944 Author: LiDong Date: Tue Aug 9 13:51:10 2022 +0800 add docker publish task commit ba8fb1d8992625fc580f385cad9525f3426b97c6 Author: 李栋 Date: Mon Aug 8 19:43:43 2022 +0800 fix homepage commit afd943014863387be44aa7c4803129a5ceb1429f Merge: 01a53b2 6852109 Author: 李栋 Date: Mon Aug 8 19:29:32 2022 +0800 Merge branch 'master' into dev commit 01a53b26a438181eb310b9b6976776065c369b90 Author: 李栋 Date: Mon Aug 8 19:24:11 2022 +0800 change build auto tag commit 2526f737ca98a230ffd1b0b5cb6147dd6a335671 Author: LiDong Date: Mon Aug 8 17:31:39 2022 +0800 default version set to development commit d423ba6ad06be5e2d187e7fed3c3973f4854b317 Author: LiDong Date: Mon Aug 8 16:47:06 2022 +0800 change README --- .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ Dockerfile | 16 +++++++++++++ internal/cmd/version.go | 2 +- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77e94cb..f1901c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,3 +60,46 @@ jobs: with: asset_paths: '["temp/${{env.BIN_NAME}}_*"]' +############################################################################################## +# 以下为Docker镜像的构建 # +# 需要提前配置好 secrets.DOCKERHUB_USERNAME 和 secrets.DOCKERHUB_PASSWORD # +# Dockerfile文件默认在 ./Dockerfile # +############################################################################################## + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + with: + install: true + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Inspect builder + run: | + echo "Name: ${{ steps.buildx.outputs.name }}" + echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" + echo "Status: ${{ steps.buildx.outputs.status }}" + echo "Flags: ${{ steps.buildx.outputs.flags }}" + echo "Platforms: ${{ steps.buildx.outputs.platforms }}" + - + name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{github.repository}} + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2d84fac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM golang AS download +WORKDIR /tmp +RUN curl -L -o hjm-certcheck https://github.com/hjmcloud/hjm-certcheck/releases/latest/download/hjm-certcheck_linux_$(go env GOARCH) + +FROM alpine +ENV WORKDIR /app +ADD resource $WORKDIR/ +# ADD ./temp/linux_amd64/main $WORKDIR/main +COPY --from=download /tmp/hjm-certcheck $WORKDIR/hjm-certcheck +RUN chmod +x $WORKDIR/hjm-certcheck + +############################################################################### +# START +############################################################################### +WORKDIR $WORKDIR +CMD ./hjm-certcheck \ No newline at end of file diff --git a/internal/cmd/version.go b/internal/cmd/version.go index de0f66f..8823007 100644 --- a/internal/cmd/version.go +++ b/internal/cmd/version.go @@ -32,7 +32,7 @@ var ( // 生成sVersion结构体 res := sVersion{ Name: "hjm-certcheck", - Homepage: "https://gitee.com/hjmcloud/hjm-certcheck", + Homepage: "https://hjmcloud.cn/hjm-certcheck", Version: data["version"].(string), GoFrame: info.GoFrame, Golang: info.Golang,