2020-05-01 14:14:37 +08:00
|
|
|
FROM golang:1.14.2 as builder
|
|
|
|
|
|
|
|
RUN mkdir -p /go/src/github.com/meshplus/bitxhub
|
|
|
|
WORKDIR /go/src/github.com/meshplus/bitxhub
|
|
|
|
|
|
|
|
# Cache dependencies
|
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
|
|
|
|
|
|
|
RUN go env -w GOPROXY=https://goproxy.cn,direct
|
|
|
|
RUN go mod download -x
|
|
|
|
|
|
|
|
# Build real binaries
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN go get -u github.com/gobuffalo/packr/packr
|
|
|
|
|
2020-05-25 20:19:12 +08:00
|
|
|
# Build bitxhub node
|
2020-05-01 14:14:37 +08:00
|
|
|
RUN make install
|
|
|
|
|
2020-05-25 20:19:12 +08:00
|
|
|
# Build raft plugin
|
|
|
|
RUN cd internal/plugins && make raft
|
|
|
|
|
|
|
|
|
2020-05-01 14:14:37 +08:00
|
|
|
# Final image
|
|
|
|
FROM frolvlad/alpine-glibc
|
2020-05-25 20:19:12 +08:00
|
|
|
RUN mkdir -p /root/.bitxhub/plugins
|
2020-05-01 14:14:37 +08:00
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
# Copy over binaries from the builder
|
|
|
|
COPY --from=builder /go/bin/bitxhub /usr/local/bin
|
|
|
|
COPY --from=builder /go/bin/packr /usr/local/bin
|
2020-05-25 20:19:12 +08:00
|
|
|
COPY --from=builder /go/src/github.com/meshplus/bitxhub/internal/plugins/build/raft.so /root/.bitxhub/plugins/
|
2020-05-01 14:14:37 +08:00
|
|
|
|
|
|
|
COPY ./build/libwasmer.so /lib
|
|
|
|
|
|
|
|
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
|
|
|
|
|
2020-05-27 15:16:58 +08:00
|
|
|
|
|
|
|
EXPOSE 60011 9091 53121 40011
|
2020-05-01 14:14:37 +08:00
|
|
|
|
|
|
|
ENTRYPOINT ["bitxhub", "start"]
|
|
|
|
|
|
|
|
|