adding build and packaging for btcwallet.
This commit is contained in:
51
docker/build/targets/btcwallet.sh
Executable file
51
docker/build/targets/btcwallet.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
NAME="btcwallet"
|
||||
|
||||
PLATFORMS=(
|
||||
"linux/386"
|
||||
"linux/amd64"
|
||||
"linux/arm/v5"
|
||||
"linux/arm/v6"
|
||||
"linux/arm/v7"
|
||||
"linux/arm64"
|
||||
# "linux/loong64"
|
||||
"linux/mips"
|
||||
"linux/mips64"
|
||||
"linux/mips64le"
|
||||
"linux/mipsle"
|
||||
"linux/ppc64"
|
||||
"linux/ppc64le"
|
||||
# "linux/riscv64"
|
||||
"linux/s390x"
|
||||
)
|
||||
|
||||
#PLATFORMS=(
|
||||
# "linux/amd64"
|
||||
# "linux/arm64"
|
||||
# "linux/arm/v7"
|
||||
#)
|
||||
|
||||
|
||||
# C bad
|
||||
export CGO_ENABLED=0
|
||||
|
||||
# BUIDL LOOP
|
||||
for i in "${PLATFORMS[@]}"; do
|
||||
|
||||
OS=$(echo $i | cut -f1 -d/)
|
||||
ARCH=$(echo $i | cut -f2 -d/)
|
||||
ARM=$(echo $i | cut -f3 -d/)
|
||||
|
||||
ARM_VARIANT=""
|
||||
|
||||
if [ "$ARM" != "" ]; then
|
||||
ARM_VARIANT="-${ARM}"
|
||||
fi
|
||||
|
||||
echo "running build for $OS-$ARCH$ARM_VARIANT"
|
||||
|
||||
GOOS=$OS GOARCH=$ARCH GOARM=$(echo $ARM | cut -f1 -dv) go build --ldflags '-w -s' \
|
||||
-o /tmp/$NAME-${source_version}/bin/$OS-$ARCH$ARM_VARIANT/btcwallet .
|
||||
|
||||
done
|
||||
26
docker/release/targets/btcwallet/btcwallet.Dockerfile
Normal file
26
docker/release/targets/btcwallet/btcwallet.Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
# ---
|
||||
# Target Configuration
|
||||
# ---
|
||||
|
||||
ARG scratch_version="latest"
|
||||
|
||||
FROM indralabs/scratch-multi-arch:${scratch_version}
|
||||
|
||||
ARG platform
|
||||
ARG version
|
||||
|
||||
## We can't use 'COPY --from=...' here. Using ADD will enable multi-architecture releases
|
||||
ADD ./release/btcwallet-${version}/bin/${platform}/btcwallet /bin
|
||||
|
||||
# Enable the btcd user
|
||||
USER btcd:btcd
|
||||
|
||||
# Set the data volumes
|
||||
#VOLUME ["/etc/btcd"]
|
||||
#VOLUME ["/var/btcd"]
|
||||
|
||||
# :8332 btcwallet RPC port
|
||||
EXPOSE 8332
|
||||
|
||||
ENTRYPOINT ["/bin/btcwallet"]
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# ---
|
||||
# Build Process
|
||||
# ---
|
||||
@@ -8,15 +9,13 @@ FROM indralabs/scratch:latest as scratch
|
||||
|
||||
FROM ${sourcing_image} as source
|
||||
|
||||
ARG source_url="https://github.com/btcsuite/btcd/releases/download"
|
||||
ARG source_version="v0.23.3"
|
||||
ARG source_url="https://github.com/btcsuite/btcwallet"
|
||||
ARG source_version="v0.16.5"
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
RUN set -ex echo "downloading source and binaries with manifest and signature." \
|
||||
&& wget ${source_url}/${source_version}/manifest-${source_version}.txt \
|
||||
&& wget ${source_url}/${source_version}/manifest-guggero-${source_version}.sig \
|
||||
&& wget ${source_url}/${source_version}/btcd-source-${source_version}.tar.gz
|
||||
RUN set -ex echo "downloading source" \
|
||||
&& git clone ${source_url}
|
||||
|
||||
# Importing keys from scratch
|
||||
COPY --from=scratch /etc/btcd/keys/guggero.asc /tmp/guggero.asc
|
||||
@@ -24,23 +23,30 @@ COPY --from=scratch /etc/btcd/keys/guggero.asc /tmp/guggero.asc
|
||||
RUN set -ex echo "importing keys" \
|
||||
&& cat guggero.asc | gpg --import
|
||||
|
||||
RUN set -ex echo "running signature verification on manifest" \
|
||||
&& gpg --verify manifest-guggero-${source_version}.sig manifest-${source_version}.txt
|
||||
WORKDIR /tmp/btcwallet
|
||||
|
||||
RUN set -ex echo "verifying checksum on btcd-source-${source_version}.tar.gz" \
|
||||
&& cat manifest-${source_version}.txt | grep btcd-source-${source_version}.tar.gz | shasum -a 256 -c
|
||||
RUN set -ex echo "checking out tag" \
|
||||
&& git checkout -b ${source_version}
|
||||
|
||||
RUN set -ex echo "untarring binaries and source code" \
|
||||
&& mv btcd-source-${source_version}.tar.gz /tmp/btcd-source.tar.gz \
|
||||
&& mkdir -pv /tmp/btcd-source \
|
||||
&& tar -xzvf btcd-source.tar.gz --directory /tmp/btcd-source
|
||||
RUN set -ex echo "running signature verification on tag" \
|
||||
&& git verify-tag ${source_version}
|
||||
|
||||
WORKDIR /tmp/btcd-source
|
||||
RUN set -ex "archiving indra source files" \
|
||||
&& git archive --format=tar.gz -o /tmp/btcwallet-source.tar.gz ${source_version}
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
RUN set -ex echo "untarring archived source code" \
|
||||
&& rm -rf btcwallet \
|
||||
&& mkdir -pv btcwallet-source \
|
||||
&& tar -xzvf btcwallet-source.tar.gz --directory btcwallet-source
|
||||
|
||||
WORKDIR /tmp/btcwallet-source
|
||||
|
||||
RUN set -ex echo "downloading modules" \
|
||||
&& go mod vendor
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=source /tmp/btcd-source /source
|
||||
COPY --from=source /tmp/btcd-source.tar.gz /source.tar.gz
|
||||
COPY --from=source /tmp/btcwallet-source /source
|
||||
COPY --from=source /tmp/btcwallet-source.tar.gz /source.tar.gz
|
||||
|
||||
Reference in New Issue
Block a user