fix: expose Trojan logs and build metadata

This commit is contained in:
chermack
2026-07-26 05:06:15 +08:00
parent cb17d56cae
commit 3cd9c2e9c8
3 changed files with 12 additions and 3 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
# syntax=docker/dockerfile:1
ARG RUNTIME_BASE=jrohy/trojan@sha256:f559fac7e9960614032e520c59405cec0e8937eca009a8169cb1d188f2b5ccb9
ARG MANAGER_VERSION=2.0.0
FROM node:20.11.1-bookworm AS frontend
WORKDIR /src
COPY trojan-web-master/package.json trojan-web-master/package-lock.json ./
@@ -13,7 +14,8 @@ COPY trojan-master/go.mod trojan-master/go.sum ./
RUN go mod download
COPY trojan-master/ ./
COPY --from=frontend /src/dist ./web/templates
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags='-s -w' -o /out/trojan .
ARG MANAGER_VERSION
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w -X trojan/trojan.MVersion=${MANAGER_VERSION} -X trojan/trojan.BuildDate=compat-image -X trojan/trojan.GoVersion=go1.21.6 -X trojan/trojan.GitVersion=local-build" -o /out/trojan .
# Production builds pass an immutable, verified runtime snapshot that contains
# the legacy Trojan core. This avoids a runtime download and preserves protocol