2019-04-10 22:13:11 +03:00
|
|
|
FROM golang:1.12-alpine as builder
|
2016-07-17 03:55:16 +03:00
|
|
|
|
2019-11-20 05:06:17 +03:00
|
|
|
LABEL maintainer="Olaoluwa Osuntokun <laolu@lightning.engineering>"
|
2016-07-17 03:55:16 +03:00
|
|
|
|
2018-05-19 06:48:15 +03:00
|
|
|
# Install build dependencies such as git and glide.
|
2018-12-01 06:06:38 +03:00
|
|
|
RUN apk add --no-cache git gcc musl-dev
|
2018-05-19 06:48:15 +03:00
|
|
|
|
2018-06-05 04:36:39 +03:00
|
|
|
WORKDIR $GOPATH/src/github.com/btcsuite/btcd
|
2018-05-19 06:48:15 +03:00
|
|
|
|
2018-06-05 04:36:39 +03:00
|
|
|
# Grab and install the latest version of of btcd and all related dependencies.
|
2018-12-01 06:06:38 +03:00
|
|
|
RUN git clone https://github.com/btcsuite/btcd.git . \
|
|
|
|
&& GO111MODULE=on go install -v . ./cmd/...
|
2018-05-19 06:48:15 +03:00
|
|
|
|
|
|
|
# Start a new image
|
|
|
|
FROM alpine as final
|
|
|
|
|
2017-01-12 03:12:32 +03:00
|
|
|
# Expose mainnet ports (server, rpc)
|
|
|
|
EXPOSE 8333 8334
|
|
|
|
|
|
|
|
# Expose testnet ports (server, rpc)
|
|
|
|
EXPOSE 18333 18334
|
|
|
|
|
|
|
|
# Expose simnet ports (server, rpc)
|
|
|
|
EXPOSE 18555 18556
|
|
|
|
|
|
|
|
# Expose segnet ports (server, rpc)
|
|
|
|
EXPOSE 28901 28902
|
|
|
|
|
2018-05-19 06:48:15 +03:00
|
|
|
# Copy the compiled binaries from the builder image.
|
|
|
|
COPY --from=builder /go/bin/addblock /bin/
|
|
|
|
COPY --from=builder /go/bin/btcctl /bin/
|
|
|
|
COPY --from=builder /go/bin/btcd /bin/
|
|
|
|
COPY --from=builder /go/bin/findcheckpoint /bin/
|
|
|
|
COPY --from=builder /go/bin/gencerts /bin/
|
2016-07-17 03:55:16 +03:00
|
|
|
|
2018-05-19 06:48:15 +03:00
|
|
|
COPY "start-btcctl.sh" .
|
|
|
|
COPY "start-btcd.sh" .
|
2016-07-17 03:55:16 +03:00
|
|
|
|
2018-05-19 06:48:15 +03:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
bash \
|
|
|
|
ca-certificates \
|
|
|
|
&& mkdir "/rpc" "/root/.btcd" "/root/.btcctl" \
|
|
|
|
&& touch "/root/.btcd/btcd.conf" \
|
|
|
|
&& chmod +x start-btcctl.sh \
|
|
|
|
&& chmod +x start-btcd.sh \
|
2017-01-12 03:12:32 +03:00
|
|
|
# Manually generate certificate and add all domains, it is needed to connect
|
|
|
|
# "btcctl" and "lnd" to "btcd" over docker links.
|
2018-05-19 06:48:15 +03:00
|
|
|
&& "/bin/gencerts" --host="*" --directory="/rpc" --force
|
2016-07-17 03:55:16 +03:00
|
|
|
|
2017-01-12 03:12:32 +03:00
|
|
|
# Create a volume to house pregenerated RPC credentials. This will be
|
|
|
|
# shared with any lnd, btcctl containers so they can securely query btcd's RPC
|
|
|
|
# server.
|
|
|
|
# You should NOT do this before certificate generation!
|
2018-02-07 06:11:11 +03:00
|
|
|
# Otherwise manually generated certificate will be overridden with shared
|
2017-01-12 03:12:32 +03:00
|
|
|
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
2016-08-30 01:17:48 +03:00
|
|
|
VOLUME ["/rpc"]
|