Dockerfile 886 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:alpine AS build
  2. RUN apk update && apk add make gcc musl-dev
  3. RUN mkdir -p /go/src/github.com/nsqio/nsq
  4. COPY . /go/src/github.com/nsqio/nsq
  5. WORKDIR /go/src/github.com/nsqio/nsq
  6. RUN ./test.sh
  7. RUN CGO_ENABLED=0 make PREFIX=/opt/nsq BLDFLAGS='-ldflags="-s -w"' install
  8. FROM alpine:latest
  9. EXPOSE 4150 4151 4160 4161 4170 4171
  10. RUN mkdir -p /data
  11. WORKDIR /data
  12. # set up nsswitch.conf for Go's "netgo" implementation
  13. # https://github.com/golang/go/issues/35305
  14. RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
  15. # Optional volumes (explicitly configure with "docker run -v ...")
  16. # /data - used by nsqd for persistent storage across restarts
  17. # /etc/ssl/certs - for SSL Root CA certificates from host
  18. COPY --from=build /opt/nsq/bin/ /usr/local/bin/
  19. RUN ln -s /usr/local/bin/*nsq* / \
  20. && ln -s /usr/local/bin/*nsq* /bin/