|
| 1 | +# Start with a Golang builder image. |
| 2 | +FROM golang:1.24.6-alpine3.22@sha256:c8c5f95d64aa79b6547f3b626eb84b16a7ce18a139e3e9ca19a8c078b85ba80d AS golangbuilder |
| 3 | + |
| 4 | +# Pass a tag, branch or a commit using build-arg. This allows a docker image to |
| 5 | +# be built from a specified Git state. |
| 6 | +ARG checkout="master" |
| 7 | + |
| 8 | +# Install dependencies and install/build chantools. |
| 9 | +RUN apk add --no-cache --update alpine-sdk make \ |
| 10 | + && git clone https://github.com/lightninglabs/chantools /go/src/github.com/lightninglabs/chantools \ |
| 11 | + && cd /go/src/github.com/lightninglabs/chantools \ |
| 12 | + && git checkout $checkout \ |
| 13 | + && make install |
| 14 | + |
| 15 | +# Start a new, final image to reduce size. |
| 16 | +FROM alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 AS final |
| 17 | + |
| 18 | +# Define a root volume for data persistence. |
| 19 | +VOLUME /chantools |
| 20 | +WORKDIR /chantools |
| 21 | + |
| 22 | +# We'll use the default / directory as the home directory, since the /chantools |
| 23 | +# folder will be overwritten if a volume is mounted there. |
| 24 | +ENV HOME=/ |
| 25 | + |
| 26 | +# We'll expect the lnd data directory to be mounted here. |
| 27 | +VOLUME /lnd |
| 28 | + |
| 29 | +# Copy the binaries and entrypoint from the builder image. |
| 30 | +COPY ./docker/docker-entrypoint.sh /bin/ |
| 31 | +COPY ./docker/bash-wrapper.sh /usr/local/bin/bash |
| 32 | +COPY --from=golangbuilder /go/bin/chantools /bin/ |
| 33 | + |
| 34 | +# Make the wrapper executable. |
| 35 | +RUN chmod 0777 /usr/local/bin/bash |
| 36 | + |
| 37 | +# Add bash. |
| 38 | +RUN apk add --no-cache \ |
| 39 | + bash \ |
| 40 | + jq \ |
| 41 | + ca-certificates |
| 42 | + |
| 43 | +# We'll want to just start a shell, but also give the user some info on how to |
| 44 | +# use this image, which we do with a shell script. |
| 45 | +ENTRYPOINT ["/bin/docker-entrypoint.sh"] |
0 commit comments