Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
372e04f6
Commit
372e04f6
authored
Feb 14, 2026
by
yangjianbo
Browse files
fix(docker): 默认从cmd/server/VERSION读取版本号
parent
e2107ce4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
372e04f6
...
...
@@ -61,9 +61,13 @@ COPY backend/ ./
COPY
--from=frontend-builder /app/backend/internal/web/dist ./internal/web/dist
# Build the binary (BuildType=release for CI builds, embed frontend)
RUN
CGO_ENABLED
=
0
GOOS
=
linux go build
\
# Version precedence: build arg VERSION > cmd/server/VERSION
RUN
VERSION_VALUE
=
"
${
VERSION
}
"
&&
\
if
[
-z
"
${
VERSION_VALUE
}
"
]
;
then
VERSION_VALUE
=
"
$(
tr
-d
'\r\n'
< ./cmd/server/VERSION
)
"
;
fi
&&
\
DATE_VALUE
=
"
${
DATE
:-
$(
date
-u
+%Y-%m-%dT%H:%M:%SZ
)
}
"
&&
\
CGO_ENABLED
=
0
GOOS
=
linux go build
\
-tags
embed
\
-ldflags
=
"-s -w -X main.Version=
${
VERSION
}
-X main.Commit=
${
COMMIT
}
-X main.Date=
${
DATE
:-
$(
date
-u
+%Y-%m-%dT%H:%M:%SZ
)
}
-X main.BuildType=release"
\
-ldflags
=
"-s -w -X main.Version=
${
VERSION
_VALUE
}
-X main.Commit=
${
COMMIT
}
-X main.Date=
${
DATE
_VALUE
}
-X main.BuildType=release"
\
-o
/app/sub2api
\
./cmd/server
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment