diff --git a/Dockerfile b/Dockerfile index a03c3a6..27f59cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,8 +41,10 @@ COPY backend/go.* ./ RUN go mod download # Copy source and build static binary +# -trimpath:抹掉源码绝对路径(否则二进制里能 strings 出 /app/backend/controllers/*.go 共 66 处) COPY backend/ ./ RUN CGO_ENABLED=0 GOOS=linux go build \ + -trimpath \ -a -installsuffix cgo \ -ldflags="-s -w -extldflags '-static'" \ -o bin/opsxloki .