From 3a64e32184632961553ba1b938072c7fa2fc14b7 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 8 Dec 2017 09:46:35 -0600 Subject: [PATCH] [mc] Add PROXY env var option For #177 --- minecraft-server/README.md | 8 ++++++++ minecraft-server/docker-compose-proxied.yml | 15 +++++++++++++++ minecraft-server/start-configuration | 7 +++++++ 3 files changed, 30 insertions(+) create mode 100644 minecraft-server/docker-compose-proxied.yml diff --git a/minecraft-server/README.md b/minecraft-server/README.md index d6b241cb..8a5032d9 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -732,3 +732,11 @@ In order to adapt to differences in `UID` and `GID` settings the entry script wi General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS` environment variable. Options like `-X` that need to proceed general JVM options can be passed via a `JVM_XX_OPTS` environment variable. + +### HTTP Proxy + +You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL via the `PROXY` +environment variable. In [the example compose file](docker-compose-proxied.yml) it references +a companion squid proxy by setting the equivalent of + + -e PROXY=proxy:3128 \ No newline at end of file diff --git a/minecraft-server/docker-compose-proxied.yml b/minecraft-server/docker-compose-proxied.yml new file mode 100644 index 00000000..dbcde6e2 --- /dev/null +++ b/minecraft-server/docker-compose-proxied.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + mc: + build: . + ports: + - 25565:25565 + environment: + EULA: "TRUE" +# TYPE: SPIGOT +# VERSION: 1.11.2 + PROXY: proxy:3128 + proxy: + image: sameersbn/squid + diff --git a/minecraft-server/start-configuration b/minecraft-server/start-configuration index 10ce5da7..be90fd39 100755 --- a/minecraft-server/start-configuration +++ b/minecraft-server/start-configuration @@ -29,6 +29,13 @@ if ! touch /data/.verify_access; then exit 2 fi +if [[ $PROXY ]]; then + export http_proxy="$PROXY" + export https_proxy="$PROXY" + echo "INFO: Giving proxy time to startup..." + sleep 5 +fi + export SERVER_PROPERTIES=/data/server.properties export FTB_DIR=/data/FeedTheBeast export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json