github.com/btcsuite/btcd@v0.24.0/Dockerfile (about) 1 # This Dockerfile builds btcd from source and creates a small (55 MB) docker container based on alpine linux. 2 # 3 # Clone this repository and run the following command to build and tag a fresh btcd amd64 container: 4 # 5 # docker build . -t yourregistry/btcd 6 # 7 # You can use the following command to buid an arm64v8 container: 8 # 9 # docker build . -t yourregistry/btcd --build-arg ARCH=arm64v8 10 # 11 # For more information how to use this docker image visit: 12 # https://github.com/btcsuite/btcd/tree/master/docs 13 # 14 # 8333 Mainnet Bitcoin peer-to-peer port 15 # 8334 Mainet RPC port 16 17 ARG ARCH=amd64 18 # using the SHA256 instead of tags 19 # https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests 20 # https://cloud.google.com/architecture/using-container-images 21 # https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md 22 # ➜ ~ crane digest golang:1.17.13-alpine3.16 23 # sha256:c80567372be0d486766593cc722d3401038e2f150a0f6c5c719caa63afb4026a 24 FROM golang@sha256:c80567372be0d486766593cc722d3401038e2f150a0f6c5c719caa63afb4026a AS build-container 25 26 ARG ARCH 27 28 ADD . /app 29 WORKDIR /app 30 RUN set -ex \ 31 && if [ "${ARCH}" = "amd64" ]; then export GOARCH=amd64; fi \ 32 && if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \ 33 && if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \ 34 && echo "Compiling for $GOARCH" \ 35 && go install -v . ./cmd/... 36 37 FROM $ARCH/alpine:3.16 38 39 COPY --from=build-container /go/bin /bin 40 41 VOLUME ["/root/.btcd"] 42 43 EXPOSE 8333 8334 44 45 ENTRYPOINT ["btcd"]