Update Dockerfile
Browse files- Dockerfile +12 -10
Dockerfile
CHANGED
@@ -30,15 +30,17 @@ EXPOSE 25565
|
|
30 |
|
31 |
# launcher script: start tunnel, wait for tcp url, print it, then run server
|
32 |
RUN printf '%s\n' \
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
|
44 |
CMD ["/start.sh"]
|
|
|
30 |
|
31 |
# launcher script: start tunnel, wait for tcp url, print it, then run server
|
32 |
RUN printf '%s\n' \
|
33 |
+
'#!/bin/sh' \
|
34 |
+
'set -e' \
|
35 |
+
'cloudflared tunnel --url tcp://localhost:25565 --no-autoupdate --logfile /tmp/cf.log --logformat json &' \
|
36 |
+
'echo "waiting for cloudflared…"' \
|
37 |
+
'while true; do' \
|
38 |
+
' MC_URL=$(grep -o "tcp://[A-Za-z0-9._-]*trycloudflare.com:[0-9]*" /tmp/cf.log | head -n1)' \
|
39 |
+
' [ -n "$MC_URL" ] && break' \
|
40 |
+
' sleep 1' \
|
41 |
+
'done' \
|
42 |
+
'echo "minecraft public endpoint: $MC_URL"' \
|
43 |
+
'exec java -Xmx2G -Xms2G -jar /minecraft/server.jar --nogui' \
|
44 |
+
> /start.sh && chmod +x /start.sh
|
45 |
|
46 |
CMD ["/start.sh"]
|