From 2df997b4cfc6552b25823c7516f9059c22b4f5a5 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 12 Sep 2023 14:27:12 +0200 Subject: [PATCH 1/3] build: fix default api address --- build/env_default.go | 2 +- build/env_testnet.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/env_default.go b/build/env_default.go index 044a4f863..b69e98eb3 100644 --- a/build/env_default.go +++ b/build/env_default.go @@ -12,7 +12,7 @@ import ( const ( network = "mainnet" - DefaultAPIAddress = "localhost:9980" + DefaultAPIAddress = ":9980" DefaultGatewayAddress = ":9981" ) diff --git a/build/env_testnet.go b/build/env_testnet.go index e1c3c78cb..c9b70e1c6 100644 --- a/build/env_testnet.go +++ b/build/env_testnet.go @@ -12,7 +12,7 @@ import ( const ( network = "zen" - DefaultAPIAddress = "localhost:9880" + DefaultAPIAddress = ":9880" DefaultGatewayAddress = ":9881" ) From 5ced8d665affbcfd7310d565c7118df62df74358 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 12 Sep 2023 14:44:56 +0200 Subject: [PATCH 2/3] build: use entrypoint script --- build/env_default.go | 2 +- build/env_testnet.go | 2 +- docker/Dockerfile | 9 ++++++++- docker/entrypoint.sh | 7 +++++++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 docker/entrypoint.sh diff --git a/build/env_default.go b/build/env_default.go index b69e98eb3..044a4f863 100644 --- a/build/env_default.go +++ b/build/env_default.go @@ -12,7 +12,7 @@ import ( const ( network = "mainnet" - DefaultAPIAddress = ":9980" + DefaultAPIAddress = "localhost:9980" DefaultGatewayAddress = ":9981" ) diff --git a/build/env_testnet.go b/build/env_testnet.go index c9b70e1c6..e1c3c78cb 100644 --- a/build/env_testnet.go +++ b/build/env_testnet.go @@ -12,7 +12,7 @@ import ( const ( network = "zen" - DefaultAPIAddress = ":9880" + DefaultAPIAddress = "localhost:9880" DefaultGatewayAddress = ":9881" ) diff --git a/docker/Dockerfile b/docker/Dockerfile index ba98ee600..a4d27d01a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,6 +37,10 @@ LABEL maintainer="The Sia Foundation " \ ENV PUID=0 ENV PGID=0 +# Entrypoint env args +ARG BUILD_TAGS +ENV BUILD_TAGS=$BUILD_TAGS + # Renterd env args ENV RENTERD_API_PASSWORD= ENV RENTERD_SEED= @@ -48,4 +52,7 @@ VOLUME [ "/data" ] USER ${PUID}:${PGID} -ENTRYPOINT [ "renterd", "-dir", "./data"] +# Copy the script and set it as the entrypoint. +COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh", "-dir", "./data"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 000000000..37202a552 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ "$BUILD_TAGS" == *'testnet'* ]]; then + exec renterd -http=':9880' "$@" +else + exec renterd -http=':9980' "$@" +fi \ No newline at end of file From 2ef60ad89ca5e2e8aefdd6bad18b82051039be3f Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 12 Sep 2023 14:45:16 +0200 Subject: [PATCH 3/3] build: add newline --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 37202a552..e5073634f 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -4,4 +4,4 @@ if [[ "$BUILD_TAGS" == *'testnet'* ]]; then exec renterd -http=':9880' "$@" else exec renterd -http=':9980' "$@" -fi \ No newline at end of file +fi