lnd/docker/btcd/Dockerfile
Olaoluwa Osuntokun 65a5eeb24e
build: make Go 1.18 the min version, update to Go 1.19
As usual, we keep with the last two Go versions, which means the last
year of Go release (they release every 6 months or so).

This change means we can now use the type params (generics) in the
project!
2022-08-23 10:54:13 -05:00

61 lines
1.8 KiB
Docker

FROM golang:1.19-alpine as builder
LABEL maintainer="Olaoluwa Osuntokun <laolu@lightning.engineering>"
# Install build dependencies such as git and glide.
RUN apk add --no-cache git gcc musl-dev
WORKDIR $GOPATH/src/github.com/btcsuite/btcd
# Pin down btcd to a version that we know works with lnd.
ARG BTCD_VERSION=v0.23.1
# Grab and install the latest version of of btcd and all related dependencies.
RUN git clone https://github.com/btcsuite/btcd.git . \
&& git checkout $BTCD_VERSION \
&& go install -v . ./cmd/...
# Start a new image
FROM alpine as final
# 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
# 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/
COPY "start-btcctl.sh" .
COPY "start-btcd.sh" .
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 \
# Manually generate certificate and add all domains, it is needed to connect
# "btcctl" and "lnd" to "btcd" over docker links.
&& "/bin/gencerts" --host="*" --directory="/rpc" --force
# 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!
# Otherwise manually generated certificate will be overridden with shared
# mounted volume! For more info read dockerfile "VOLUME" documentation.
VOLUME ["/rpc"]