This commit is contained in:
jinnrry 2024-03-01 21:27:02 +08:00
parent a4fce30857
commit 4f150fbf18
4 changed files with 10 additions and 7 deletions

View File

@ -51,6 +51,7 @@ jobs:
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
build-args: VERSION=${{ env.VERSION }}
context: .
file: ./DockerfileGithubAction
platforms: |

View File

@ -1,11 +1,11 @@
FROM golang:alpine as serverbuild
ARG VERSION
WORKDIR /work
COPY server .
RUN apk update && apk add git
RUN go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
RUN go build -ldflags "-s -w -X 'main.version=${VERSION}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
RUN cd /work/hooks/telegram_push && go build -ldflags "-s -w" -o output/telegram_push telegram_push.go
RUN cd /work/hooks/web_push && go build -ldflags "-s -w" -o output/web_push web_push.go
RUN cd /work/hooks/wechat_push && go build -ldflags "-s -w" -o output/wechat_push wechat_push.go
@ -24,8 +24,8 @@ RUN apk add --no-cache tzdata \
COPY --from=serverbuild /work/pmail .
COPY --from=serverbuild /work/hooks/telegram_push/output/* ./plugin/
COPY --from=serverbuild /work/hooks/web_push/output/* ./plugin/
COPY --from=serverbuild /work/hooks/wechat_push/output/* ./plugin/
COPY --from=serverbuild /work/hooks/telegram_push/output/* ./plugins/
COPY --from=serverbuild /work/hooks/web_push/output/* ./plugins/
COPY --from=serverbuild /work/hooks/wechat_push/output/* ./plugins/
CMD /work/pmail

View File

@ -41,8 +41,6 @@ type Config struct {
//go:embed tables/*
var tableConfig embed.FS
const Version = "2.4.0"
const DBTypeMySQL = "mysql"
const DBTypeSQLite = "sqlite"
const SSLTypeAuto = "0" //自动生成证书

View File

@ -74,6 +74,10 @@ func main() {
log.SetLevel(log.InfoLevel)
}
if version == "" {
version = "2.4.0"
}
log.Infoln("***************************************************")
log.Infof("***\tServer Start Success Version:%s\n", version)
log.Infof("***\tGit Commit Hash: %s ", gitHash)