Skip to content

Commit

Permalink
修改 docker 编译
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdgy committed Jan 29, 2024
1 parent ef3f2ab commit 9099aea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ jobs:
run: |
appVer=`cat version`
commitId=`git rev-parse HEAD`
buildDate=`date --iso-8601=seconds`
echo "APP_VER=$appVer" >> $GITHUB_ENV
echo "commitId=$commitId" >> $GITHUB_ENV
echo "buildDate=$buildDate" >> $GITHUB_ENV
cd server;go mod tidy
Expand All @@ -64,7 +62,7 @@ jobs:
file: ./docker/Dockerfile
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build-args: appVer=${{ env.APP_VER }} commitId=${{ env.commitId }} buildDate=${{ env.buildDate }}
build-args: appVer=${{ env.APP_VER }} commitId=${{ env.commitId }}
#tags: bjdgyc/anylink:latest,bjdgyc/anylink:${{ env.APP_VER }}
tags: bjdgyc/anylink:${{ env.APP_VER }}

Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ FROM golang:1.20-alpine3.19 as builder_golang
ARG CN="no"
ARG appVer="appVer"
ARG commitId="commitId"
ARG buildDate="2020-1-1T11:11:11"

ENV TZ=Asia/Shanghai

Expand Down
4 changes: 3 additions & 1 deletion docker/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ cd /server

#go mod tidy

go build -o anylink -trimpath -ldflags "-s -w -extldflags '-static' -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$buildDate"
ldflags="-s -w -extldflags '-static' -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds)"

go build -o anylink -trimpath -ldflags "$ldflags"

ls -l /server/

Expand Down

0 comments on commit 9099aea

Please sign in to comment.