Merge pull request #1260 from tyzbit/btcd-ltcd-docker
Docker: Use multi-stage builds and Alpine containers for btcd and ltcd
This commit is contained in:
commit
5c42a88038
@ -1,7 +1,23 @@
|
|||||||
FROM golang:1.10
|
FROM golang:1.10-alpine as builder
|
||||||
|
|
||||||
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.network>
|
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.network>
|
||||||
|
|
||||||
|
# Install build dependencies such as git and glide.
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
git \
|
||||||
|
&& go get -u github.com/Masterminds/glide
|
||||||
|
|
||||||
|
WORKDIR $GOPATH/src/github.com/roasbeef/btcd
|
||||||
|
|
||||||
|
# Grab and install the latest version of roasbeef's fork of btcd and all
|
||||||
|
# related dependencies.
|
||||||
|
RUN git clone https://github.com/roasbeef/btcd . \
|
||||||
|
&& glide install \
|
||||||
|
&& go install . ./cmd/...
|
||||||
|
|
||||||
|
# Start a new image
|
||||||
|
FROM alpine as final
|
||||||
|
|
||||||
# Expose mainnet ports (server, rpc)
|
# Expose mainnet ports (server, rpc)
|
||||||
EXPOSE 8333 8334
|
EXPOSE 8333 8334
|
||||||
|
|
||||||
@ -14,21 +30,26 @@ EXPOSE 18555 18556
|
|||||||
# Expose segnet ports (server, rpc)
|
# Expose segnet ports (server, rpc)
|
||||||
EXPOSE 28901 28902
|
EXPOSE 28901 28902
|
||||||
|
|
||||||
# Grab and install the latest version of roasbeef's fork of btcd and all
|
# Copy the compiled binaries from the builder image.
|
||||||
# related dependencies.
|
COPY --from=builder /go/bin/addblock /bin/
|
||||||
RUN go get -u github.com/Masterminds/glide
|
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/
|
||||||
|
|
||||||
WORKDIR $GOPATH/src/github.com/roasbeef/btcd
|
COPY "start-btcctl.sh" .
|
||||||
RUN git clone https://github.com/roasbeef/btcd .
|
COPY "start-btcd.sh" .
|
||||||
RUN glide install
|
|
||||||
RUN go install . ./cmd/...
|
|
||||||
|
|
||||||
RUN mkdir "/rpc" "/root/.btcd" "/root/.btcctl"
|
|
||||||
RUN touch "/root/.btcd/btcd.conf"
|
|
||||||
|
|
||||||
|
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
|
# Manually generate certificate and add all domains, it is needed to connect
|
||||||
# "btcctl" and "lnd" to "btcd" over docker links.
|
# "btcctl" and "lnd" to "btcd" over docker links.
|
||||||
RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
|
&& "/bin/gencerts" --host="*" --directory="/rpc" --force
|
||||||
|
|
||||||
# Create a volume to house pregenerated RPC credentials. This will be
|
# 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
|
# shared with any lnd, btcctl containers so they can securely query btcd's RPC
|
||||||
@ -37,10 +58,3 @@ RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
|
|||||||
# Otherwise manually generated certificate will be overridden with shared
|
# Otherwise manually generated certificate will be overridden with shared
|
||||||
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
||||||
VOLUME ["/rpc"]
|
VOLUME ["/rpc"]
|
||||||
|
|
||||||
COPY "start-btcctl.sh" .
|
|
||||||
COPY "start-btcd.sh" .
|
|
||||||
|
|
||||||
RUN chmod +x start-btcctl.sh
|
|
||||||
RUN chmod +x start-btcd.sh
|
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ RUN apk add --no-cache \
|
|||||||
git \
|
git \
|
||||||
make \
|
make \
|
||||||
&& cd /go/src/github.com/lightningnetwork/lnd \
|
&& cd /go/src/github.com/lightningnetwork/lnd \
|
||||||
&& make
|
&& make \
|
||||||
|
&& make install
|
||||||
|
|
||||||
# Start a new, final image to reduce size.
|
# Start a new, final image to reduce size.
|
||||||
FROM alpine as final
|
FROM alpine as final
|
||||||
@ -23,8 +24,8 @@ FROM alpine as final
|
|||||||
EXPOSE 9735 10009
|
EXPOSE 9735 10009
|
||||||
|
|
||||||
# Copy the binaries and entrypoint from the builder image.
|
# Copy the binaries and entrypoint from the builder image.
|
||||||
COPY --from=builder /go/src/github.com/lightningnetwork/lnd/lncli /bin/
|
COPY --from=builder /go/bin/lncli /bin/
|
||||||
COPY --from=builder /go/src/github.com/lightningnetwork/lnd/lnd /bin/
|
COPY --from=builder /go/bin/lnd /bin/
|
||||||
|
|
||||||
# Add bash.
|
# Add bash.
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
FROM golang:1.10
|
FROM golang:1.10-alpine as builder
|
||||||
|
|
||||||
MAINTAINER Olaoluwa Osuntokun <lightning.engineering>
|
MAINTAINER Olaoluwa Osuntokun <lightning.engineering>
|
||||||
|
|
||||||
|
# Grab and install the latest version of roasbeef's fork of ltcd and all
|
||||||
|
# related dependencies.
|
||||||
|
WORKDIR $GOPATH/src/github.com/ltcsuite/ltcd
|
||||||
|
RUN apk add --no-cache git \
|
||||||
|
&& git clone https://github.com/ltcsuite/ltcd ./ \
|
||||||
|
&& go get -u github.com/Masterminds/glide \
|
||||||
|
&& glide install \
|
||||||
|
&& go install . ./cmd/ltcctl ./cmd/gencerts
|
||||||
|
|
||||||
|
# Start a new image
|
||||||
|
FROM alpine as final
|
||||||
|
|
||||||
# Expose mainnet ports (server, rpc)
|
# Expose mainnet ports (server, rpc)
|
||||||
EXPOSE 8333 8334
|
EXPOSE 8333 8334
|
||||||
|
|
||||||
@ -14,19 +26,23 @@ EXPOSE 18555 18556
|
|||||||
# Expose segnet ports (server, rpc)
|
# Expose segnet ports (server, rpc)
|
||||||
EXPOSE 28901 28902
|
EXPOSE 28901 28902
|
||||||
|
|
||||||
# Grab and install the latest version of roasbeef's fork of ltcd and all
|
# Copy the compiled binaries from the builder image.
|
||||||
# related dependencies.
|
COPY --from=builder /go/bin/ltcctl /bin/
|
||||||
WORKDIR $GOPATH/src/github.com/ltcsuite/ltcd
|
COPY --from=builder /go/bin/ltcd /bin/
|
||||||
RUN git clone https://github.com/ltcsuite/ltcd ./
|
COPY --from=builder /go/bin/gencerts /bin/
|
||||||
RUN go get -u github.com/Masterminds/glide
|
|
||||||
RUN glide install
|
|
||||||
RUN go install . ./cmd/ltcctl ./cmd/gencerts
|
|
||||||
|
|
||||||
RUN mkdir "/rpc" "/root/.ltcd" "/root/.ltcctl"
|
COPY "start-ltcctl.sh" .
|
||||||
RUN touch "/root/.ltcd/ltcd.conf"
|
COPY "start-ltcd.sh" .
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
ca-certificates \
|
||||||
|
&& chmod +x start-ltcctl.sh \
|
||||||
|
&& chmod +x start-ltcd.sh \
|
||||||
|
&& mkdir "/rpc" "/root/.ltcd" "/root/.ltcctl" \
|
||||||
|
&& touch "/root/.ltcd/ltcd.conf" \
|
||||||
# "ltcctl" and "lnd" to "ltcd" over docker links.
|
# "ltcctl" and "lnd" to "ltcd" over docker links.
|
||||||
RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
|
&& "/bin/gencerts" --host="*" --directory="/rpc" --force
|
||||||
|
|
||||||
# Create a volume to house pregenerated RPC credentials. This will be
|
# Create a volume to house pregenerated RPC credentials. This will be
|
||||||
# shared with any lnd, btcctl containers so they can securely query ltcd's RPC
|
# shared with any lnd, btcctl containers so they can securely query ltcd's RPC
|
||||||
@ -35,10 +51,3 @@ RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
|
|||||||
# Otherwise manually generated certificate will be overridden with shared
|
# Otherwise manually generated certificate will be overridden with shared
|
||||||
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
||||||
VOLUME ["/rpc"]
|
VOLUME ["/rpc"]
|
||||||
|
|
||||||
COPY "start-ltcctl.sh" .
|
|
||||||
COPY "start-ltcd.sh" .
|
|
||||||
|
|
||||||
RUN chmod +x start-ltcctl.sh
|
|
||||||
RUN chmod +x start-ltcd.sh
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user