精简发布包:去除打包时冗余的 conf/nps.conf、web 目录 清理失效配置项:移除 appname、runmode、https_default_cert_file、https_default_key_file、https_just_proxy
12 lines
276 B
Docker
Executable File
12 lines
276 B
Docker
Executable File
FROM golang:1.24 as builder
|
|
ARG GOPROXY=direct
|
|
WORKDIR /go/src/ehang.io/nps
|
|
COPY . .
|
|
RUN go get -d -v ./...
|
|
RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/nps/nps.go
|
|
|
|
FROM scratch
|
|
COPY --from=builder /go/src/ehang.io/nps/nps /
|
|
VOLUME /conf
|
|
CMD ["/nps"]
|