Dockerfile.go_build 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. FROM golang:1.19-alpine as builder
  2. RUN apk add git g++ fuse
  3. RUN mkdir -p /go/src/github.com/seaweedfs/
  4. RUN git clone https://github.com/seaweedfs/seaweedfs /go/src/github.com/seaweedfs/seaweedfs
  5. ARG BRANCH=${BRANCH:-master}
  6. ARG TAGS
  7. RUN cd /go/src/github.com/seaweedfs/seaweedfs && git checkout $BRANCH
  8. RUN cd /go/src/github.com/seaweedfs/seaweedfs/weed \
  9. && export LDFLAGS="-X github.com/seaweedfs/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \
  10. && CGO_ENABLED=0 go install -tags "$TAGS" -ldflags "-extldflags -static ${LDFLAGS}"
  11. FROM alpine AS final
  12. LABEL author="Chris Lu"
  13. COPY --from=builder /go/bin/weed /usr/bin/
  14. RUN mkdir -p /etc/seaweedfs
  15. COPY --from=builder /go/src/github.com/seaweedfs/seaweedfs/docker/filer.toml /etc/seaweedfs/filer.toml
  16. COPY --from=builder /go/src/github.com/seaweedfs/seaweedfs/docker/entrypoint.sh /entrypoint.sh
  17. RUN apk add fuse # for weed mount
  18. # volume server gprc port
  19. EXPOSE 18080
  20. # volume server http port
  21. EXPOSE 8080
  22. # filer server gprc port
  23. EXPOSE 18888
  24. # filer server http port
  25. EXPOSE 8888
  26. # master server shared gprc port
  27. EXPOSE 19333
  28. # master server shared http port
  29. EXPOSE 9333
  30. # s3 server http port
  31. EXPOSE 8333
  32. # webdav server http port
  33. EXPOSE 7333
  34. RUN mkdir -p /data/filerldb2
  35. VOLUME /data
  36. WORKDIR /data
  37. RUN chmod +x /entrypoint.sh
  38. ENTRYPOINT ["/entrypoint.sh"]