feat: 构建版本
This commit is contained in:
2
.github/workflows/docker-build.yml
vendored
2
.github/workflows/docker-build.yml
vendored
@@ -56,6 +56,8 @@ jobs:
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
|
||||
- name: Generate artifact attestation
|
||||
if: github.event_name != 'pull_request' && steps.build.outputs.digest != ''
|
||||
|
@@ -1,13 +1,15 @@
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
ARG VERSION=1.0.0
|
||||
WORKDIR /build
|
||||
COPY ./web .
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
RUN VITE_VERSION=${VERSION} npm run build
|
||||
|
||||
|
||||
FROM golang:alpine AS builder2
|
||||
|
||||
ARG VERSION=1.0.0
|
||||
ENV GO111MODULE=on \
|
||||
CGO_ENABLED=0 \
|
||||
GOOS=linux
|
||||
@@ -19,7 +21,7 @@ RUN go mod download
|
||||
|
||||
COPY . .
|
||||
COPY --from=builder /build/dist ./web/dist
|
||||
RUN go build -ldflags "-s -w " -o gpt-load
|
||||
RUN go build -ldflags "-s -w -X gpt-load/internal/version.Version=${VERSION}" -o gpt-load
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
3
internal/version/version.go
Normal file
3
internal/version/version.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package version
|
||||
|
||||
var Version = "1.0.0"
|
Reference in New Issue
Block a user