forked from sipa/bitcoin-seeder
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD docker support
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM debian:12 AS builder | ||
COPY . /srv/ | ||
RUN apt update | ||
RUN apt -y install build-essential libboost-all-dev libssl-dev | ||
WORKDIR /srv | ||
RUN make | ||
|
||
FROM debian:12 | ||
RUN apt update && \ | ||
apt install -y libssl3 --no-install-recommends && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
WORKDIR /home/dnsseed | ||
COPY --from=builder /srv/dnsseed /home/dnsseed/ | ||
COPY entrypoint.sh / | ||
|
||
# Set the entrypoint to your script | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
# Default CMD if no arguments are provided (this can be overwritten at runtime) | ||
CMD ["/home/dnsseed/dnsseed"] |
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,35 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# Default values for environment variables if not set | ||
export SEED_HOSTNAME=${SEED_HOSTNAME} | ||
export NODE_HOSTNAME=${NODE_HOSTNAME} | ||
export EMAIL=${EMAIL} | ||
export THREADS=${THREADS} | ||
export ADDRESS=${ADDRESS:-"0.0.0.0"} | ||
export PORT=${PORT:-"53"} | ||
export NETWORK=${NETWORK:-"mainnet"} # Default to "mainnet" unless otherwise set | ||
|
||
# Extra arguments for testnet | ||
extra_args="" | ||
if [[ "$NETWORK" == "testnet" ]]; then | ||
export extra_args="--testnet" | ||
fi | ||
|
||
# If the first argument starts with a hyphen (-), consider it an argument for the dnsseed binary | ||
if [[ "${1:0:1}" == "-" ]]; then | ||
exec /home/dnsseed/dnsseed "$@" | ||
fi | ||
|
||
# Run the dnsseed binary with default arguments and extra_args, or run another command if provided | ||
if [ "$1" == "/home/dnsseed/dnsseed" ]; then | ||
exec /home/dnsseed/dnsseed -h "$SEED_HOSTNAME" \ | ||
-n "$NODE_HOSTNAME" \ | ||
-a "$ADDRESS" \ | ||
-p "$PORT" \ | ||
-m "$EMAIL" \ | ||
-t "$THREADS" "$extra_args" | ||
else | ||
# If another command is passed, run that instead | ||
exec "$@" | ||
fi |