-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [[ "$1" == "groestlcoin-cli" || "$1" == "groestlcoin-tx" || "$1" == "groestlcoind" || "$1" == "test_groestlcoin" ]]; then | ||
mkdir -p "$GROESTLCOIN_DATA" | ||
|
||
CONFIG_PREFIX="" | ||
if [[ "${GROESTLCOIN_NETWORK}" == "regtest" ]]; then | ||
CONFIG_PREFIX=$'regtest=1\n[regtest]' | ||
elif [[ "${GROESTLCOIN_NETWORK}" == "testnet" ]]; then | ||
CONFIG_PREFIX=$'testnet=1\n[test]' | ||
elif [[ "${GROESTLCOIN_NETWORK}" == "mainnet" ]]; then | ||
CONFIG_PREFIX=$'mainnet=1\n[main]' | ||
elif [[ "${GROESTLCOIN_NETWORK}" == "signet" ]]; then | ||
CONFIG_PREFIX=$'signet=1\n[signet]' | ||
else | ||
GROESTLCOIN_NETWORK="mainnet" | ||
CONFIG_PREFIX=$'mainnet=1\n[main]' | ||
fi | ||
|
||
if [[ "$GROESTLCOIN_WALLETDIR" ]] && [[ "$GROESTLCOIN_NETWORK" ]]; then | ||
NL=$'\n' | ||
WALLETDIR="$GROESTLCOIN_WALLETDIR/${GROESTLCOIN_NETWORK}" | ||
WALLETFILE="${WALLETDIR}/wallet.dat" | ||
mkdir -p "$WALLETDIR" | ||
chown -R groestlcoin:groestlcoin "$WALLETDIR" | ||
CONFIG_PREFIX="${CONFIG_PREFIX}${NL}walletdir=${WALLETDIR}${NL}" | ||
if ! [[ -f "${WALLETFILE}" ]]; then | ||
echo "The wallet does not exists, creating it at ${WALLETDIR}..." | ||
gosu groestlcoin groestlcoin-wallet "-datadir=${WALLETDIR}" "-wallet=" create | ||
fi | ||
fi | ||
|
||
cat <<-EOF > "$GROESTLCOIN_DATA/groestlcoin.conf" | ||
${CONFIG_PREFIX} | ||
printtoconsole=1 | ||
rpcallowip=::/0 | ||
${GROESTLCOIN_EXTRA_ARGS} | ||
EOF | ||
chown groestlcoin:groestlcoin "$GROESTLCOIN_DATA/groestlcoin.conf" | ||
|
||
if [[ "${GROESTLCOIN_TORCONTROL}" ]]; then | ||
# Because groestlcoind only accept torcontrol= host as an ip only, we resolve it here and add to config | ||
TOR_CONTROL_HOST=$(echo ${GROESTLCOIN_TORCONTROL} | cut -d ':' -f 1) | ||
TOR_CONTROL_PORT=$(echo ${GROESTLCOIN_TORCONTROL} | cut -d ':' -f 2) | ||
if [[ "$TOR_CONTROL_HOST" ]] && [[ "$TOR_CONTROL_PORT" ]]; then | ||
TOR_IP=$(getent hosts $TOR_CONTROL_HOST | cut -d ' ' -f 1) | ||
echo "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" >> "$GROESTLCOIN_DATA/groestlcoin.conf" | ||
echo "Added "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" to $GROESTLCOIN_DATA/groestlcoin.conf" | ||
else | ||
echo "Invalid GROESTLCOIN_TORCONTROL" | ||
fi | ||
fi | ||
|
||
# ensure correct ownership and linking of data directory | ||
# we do not update group ownership here, in case users want to mount | ||
# a host directory and still retain access to it | ||
chown -R groestlcoin "$GROESTLCOIN_DATA" | ||
ln -sfn "$GROESTLCOIN_DATA" /home/groestlcoin/.groestlcoin | ||
chown -h groestlcoin:groestlcoin /home/groestlcoin/.groestlcoin | ||
rm -f /home/groestlcoin/.groestlcoin/settings.json | ||
exec gosu groestlcoin "$@" | ||
else | ||
exec "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM debian:buster-slim as builder | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget | ||
|
||
ENV GROESTLCOIN_VERSION 24.0.1 | ||
ENV GROESTLCOIN_TARBALL groestlcoin-${GROESTLCOIN_VERSION}-x86_64-linux-gnu.tar.gz | ||
ENV GROESTLCOIN_URL https://github.com/Groestlcoin/groestlcoin/releases/download/v$GROESTLCOIN_VERSION/$GROESTLCOIN_TARBALL | ||
ENV GROESTLCOIN_SHA256 4b69743190e2697d7b7772bf6f63cde595d590ff6664abf15a7201dab2a6098b | ||
|
||
# install groestlcoin binaries | ||
RUN set -ex \ | ||
&& cd /tmp \ | ||
&& wget -qO $GROESTLCOIN_TARBALL "$GROESTLCOIN_URL" \ | ||
&& echo "$GROESTLCOIN_SHA256 $GROESTLCOIN_TARBALL" | sha256sum -c - \ | ||
&& mkdir bin \ | ||
&& tar -xzvf $GROESTLCOIN_TARBALL -C /tmp/bin --strip-components=2 "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-cli" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoind" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-wallet" \ | ||
&& cd bin \ | ||
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" \ | ||
&& echo "0b843df6d86e270c5b0f5cbd3c326a04e18f4b7f9b8457fa497b0454c4b138d7 gosu" | sha256sum -c - | ||
|
||
FROM debian:buster-slim | ||
COPY --from=builder "/tmp/bin" /usr/local/bin | ||
|
||
RUN chmod +x /usr/local/bin/gosu && groupadd -r groestlcoin && useradd -r -m -g groestlcoin groestlcoin | ||
|
||
# create data directory | ||
ENV GROESTLCOIN_DATA /data | ||
RUN mkdir "$GROESTLCOIN_DATA" \ | ||
&& chown -R groestlcoin:groestlcoin "$GROESTLCOIN_DATA" \ | ||
&& ln -sfn "$GROESTLCOIN_DATA" /home/groestlcoin/.groestlcoin \ | ||
&& chown -h groestlcoin:groestlcoin /home/groestlcoin/.groestlcoin | ||
|
||
VOLUME /data | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE 1331 1441 17777 17766 18888 18443 31331 31441 | ||
CMD ["groestlcoind"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Use manifest image which support all architecture | ||
FROM debian:buster-slim as builder | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget | ||
RUN apt-get install -qq --no-install-recommends qemu-user-static binfmt-support | ||
|
||
ENV GROESTLCOIN_VERSION 24.0.1 | ||
ENV GROESTLCOIN_TARBALL groestlcoin-${GROESTLCOIN_VERSION}-arm-linux-gnueabihf.tar.gz | ||
ENV GROESTLCOIN_URL https://github.com/Groestlcoin/groestlcoin/releases/download/v$GROESTLCOIN_VERSION/$GROESTLCOIN_TARBALL | ||
ENV GROESTLCOIN_SHA256 28299bc5eccbf715c9b876467da7c12cd8b5261753ed614a7d3a81c9da79dcb8 | ||
|
||
# install groestlcoin binaries | ||
RUN set -ex \ | ||
&& cd /tmp \ | ||
&& wget -qO $GROESTLCOIN_TARBALL "$GROESTLCOIN_URL" \ | ||
&& echo "$GROESTLCOIN_SHA256 $GROESTLCOIN_TARBALL" | sha256sum -c - \ | ||
&& mkdir bin \ | ||
&& tar -xzvf $GROESTLCOIN_TARBALL -C /tmp/bin --strip-components=2 "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-cli" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoind" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-wallet" \ | ||
&& cd bin \ | ||
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-armhf" \ | ||
&& echo "171b4a2decc920de0dd4f49278d3e14712da5fa48de57c556f99bcdabe03552e gosu" | sha256sum -c - | ||
|
||
# Making sure the builder build an arm image despite being x64 | ||
FROM arm32v7/debian:buster-slim | ||
|
||
COPY --from=builder "/tmp/bin" /usr/local/bin | ||
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static | ||
|
||
RUN chmod +x /usr/local/bin/gosu && groupadd -r groestlcoin && useradd -r -m -g groestlcoin groestlcoin | ||
|
||
# create data directory | ||
ENV GROESTLCOIN_DATA /data | ||
RUN mkdir "$GROESTLCOIN_DATA" \ | ||
&& chown -R groestlcoin:groestlcoin "$GROESTLCOIN_DATA" \ | ||
&& ln -sfn "$GROESTLCOIN_DATA" /home/groestlcoin/.groestlcoin \ | ||
&& chown -h groestlcoin:groestlcoin /home/groestlcoin/.groestlcoin | ||
|
||
VOLUME /data | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE 1331 1441 17777 17766 18888 18443 31331 31441 | ||
CMD ["groestlcoind"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Use manifest image which support all architecture | ||
FROM debian:buster-slim as builder | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget | ||
RUN apt-get install -qq --no-install-recommends qemu-user-static binfmt-support | ||
|
||
ENV GROESTLCOIN_VERSION 24.0.1 | ||
ENV GROESTLCOIN_TARBALL groestlcoin-${GROESTLCOIN_VERSION}-aarch64-linux-gnu.tar.gz | ||
ENV GROESTLCOIN_URL https://github.com/Groestlcoin/groestlcoin/releases/download/v$GROESTLCOIN_VERSION/$GROESTLCOIN_TARBALL | ||
ENV GROESTLCOIN_SHA256 ca316c369728348406778c30b2b567bb2ede1ebcc87fb0305c0bed3dacae762b | ||
|
||
# install groestlcoin binaries | ||
RUN set -ex \ | ||
&& cd /tmp \ | ||
&& wget -qO $GROESTLCOIN_TARBALL "$GROESTLCOIN_URL" \ | ||
&& echo "$GROESTLCOIN_SHA256 $GROESTLCOIN_TARBALL" | sha256sum -c - \ | ||
&& mkdir bin \ | ||
&& tar -xzvf $GROESTLCOIN_TARBALL -C /tmp/bin --strip-components=2 "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-cli" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoind" "groestlcoin-$GROESTLCOIN_VERSION/bin/groestlcoin-wallet" \ | ||
&& cd bin \ | ||
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-arm64" \ | ||
&& echo "5e279972a1c7adee65e3b5661788e8706594b458b7ce318fecbd392492cc4dbd gosu" | sha256sum -c - | ||
|
||
# Making sure the builder build an arm image despite being x64 | ||
FROM arm64v8/debian:buster-slim | ||
|
||
COPY --from=builder "/tmp/bin" /usr/local/bin | ||
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static | ||
|
||
RUN chmod +x /usr/local/bin/gosu && groupadd -r groestlcoin && useradd -r -m -g groestlcoin groestlcoin | ||
|
||
# create data directory | ||
ENV GROESTLCOIN_DATA /data | ||
RUN mkdir "$GROESTLCOIN_DATA" \ | ||
&& chown -R groestlcoin:groestlcoin "$GROESTLCOIN_DATA" \ | ||
&& ln -sfn "$GROESTLCOIN_DATA" /home/groestlcoin/.groestlcoin \ | ||
&& chown -h groestlcoin:groestlcoin /home/groestlcoin/.groestlcoin | ||
|
||
VOLUME /data | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE 1331 1441 17777 17766 18888 18443 31331 31441 | ||
CMD ["groestlcoind"] |