Files
nats-server/docker/Dockerfile.nightly
Yaxiong Zhao b0cecaf666 Remove '-s' flag from ldflags from the build
This retains the symbols (but still removes the dwarf info).
This increases the executable size by ~8% (test on my laptop):

$ go build -ldflags '-w' -o nats-server
-rwxrwxr-x 1 yzhao yzhao 11911273 Jul 28 15:52 nats-server

$ go build -ldflags '-s -w' -o nats-server
-rwxrwxr-x 1 yzhao yzhao 11128832 Jul 28 15:52 nats-server

Symbols are very useful during debugging. It would be great that if the
NATS team consider including symbols.
2021-07-28 15:56:58 -07:00

27 lines
714 B
Docker

FROM golang:1.16-alpine AS builder
ARG VERSION="nightly"
RUN apk add --update git
RUN mkdir -p src/github.com/nats-io && \
cd src/github.com/nats-io/ && \
git clone https://github.com/nats-io/natscli.git && \
cd natscli/nats && \
go build -ldflags "-w -X main.version=${VERSION}" -o /nats
RUN go get github.com/nats-io/nsc
FROM alpine:latest
RUN apk add --update ca-certificates && mkdir -p /nats/bin && mkdir /nats/conf
COPY docker/nats-server.conf /nats/conf/nats-server.conf
COPY nats-server /bin/nats-server
COPY --from=builder /nats /bin/nats
COPY --from=builder /go/bin/nsc /bin/nsc
EXPOSE 4222 8222 6222 5222
ENTRYPOINT ["/bin/nats-server"]
CMD ["-c", "/nats/conf/nats-server.conf"]