Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +110 -0
Dockerfile
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM debian:12-slim
|
| 2 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 3 |
+
ENV LANG=C.UTF-8
|
| 4 |
+
|
| 5 |
+
RUN mkdir -p /usr/share/binfmts && \
|
| 6 |
+
apt-get update && \
|
| 7 |
+
apt-get install -y --no-install-recommends \
|
| 8 |
+
openjdk-17-jdk-headless \
|
| 9 |
+
wget \
|
| 10 |
+
curl \
|
| 11 |
+
netcat-openbsd \
|
| 12 |
+
procps \
|
| 13 |
+
python3 \
|
| 14 |
+
python3-pip \
|
| 15 |
+
python3-setuptools \
|
| 16 |
+
python3-wheel \
|
| 17 |
+
ca-certificates && \
|
| 18 |
+
dpkg --configure -a || true && \
|
| 19 |
+
rm -rf /var/lib/apt/lists/* && \
|
| 20 |
+
apt-get clean
|
| 21 |
+
|
| 22 |
+
RUN pip3 install --no-cache-dir --break-system-packages "huggingface_hub[cli]>=1.5.0"
|
| 23 |
+
|
| 24 |
+
# RCON client
|
| 25 |
+
RUN printf '#!/usr/bin/env python3\n\
|
| 26 |
+
import socket, struct, sys, argparse\n\
|
| 27 |
+
\n\
|
| 28 |
+
def rcon(host, port, password, command):\n\
|
| 29 |
+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\
|
| 30 |
+
s.settimeout(5)\n\
|
| 31 |
+
s.connect((host, int(port)))\n\
|
| 32 |
+
payload = struct.pack("<ii", 0, 3) + password.encode("utf-8") + b"\\x00\\x00"\n\
|
| 33 |
+
s.send(struct.pack("<i", len(payload)) + payload)\n\
|
| 34 |
+
resp = s.recv(4096)\n\
|
| 35 |
+
payload = struct.pack("<ii", 1, 2) + command.encode("utf-8") + b"\\x00\\x00"\n\
|
| 36 |
+
s.send(struct.pack("<i", len(payload)) + payload)\n\
|
| 37 |
+
resp = s.recv(4096)\n\
|
| 38 |
+
if len(resp) >= 12:\n\
|
| 39 |
+
return resp[12:].decode("utf-8", errors="ignore").rstrip("\\x00")\n\
|
| 40 |
+
return ""\n\
|
| 41 |
+
\n\
|
| 42 |
+
if __name__ == "__main__":\n\
|
| 43 |
+
p = argparse.ArgumentParser()\n\
|
| 44 |
+
p.add_argument("-H", "--host", default="127.0.0.1")\n\
|
| 45 |
+
p.add_argument("-P", "--port", default="25575")\n\
|
| 46 |
+
p.add_argument("-p", "--password", default="")\n\
|
| 47 |
+
p.add_argument("commands", nargs="*")\n\
|
| 48 |
+
args = p.parse_args()\n\
|
| 49 |
+
for cmd in args.commands:\n\
|
| 50 |
+
try:\n\
|
| 51 |
+
result = rcon(args.host, int(args.port), args.password, cmd)\n\
|
| 52 |
+
if result:\n\
|
| 53 |
+
print(result)\n\
|
| 54 |
+
except Exception as e:\n\
|
| 55 |
+
print("RCON error: " + str(e), file=sys.stderr)\n' > /usr/local/bin/mcrcon && chmod +x /usr/local/bin/mcrcon
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
WORKDIR /opt/server
|
| 59 |
+
RUN mkdir -p /opt/server/bungee/plugins /opt/server/backend/plugins
|
| 60 |
+
|
| 61 |
+
RUN wget -O /opt/server/bungee/BungeeCord.jar \
|
| 62 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/bootstrap/target/BungeeCord.jar"
|
| 63 |
+
|
| 64 |
+
RUN wget -O /opt/server/bungee/sqlite-jdbc.jar \
|
| 65 |
+
"https://github.com/xerial/sqlite-jdbc/releases/download/3.45.3.0/sqlite-jdbc-3.45.3.0.jar"
|
| 66 |
+
|
| 67 |
+
RUN mkdir -p /opt/server/bungee/modules && \
|
| 68 |
+
wget -O /opt/server/bungee/modules/cmd_alert.jar \
|
| 69 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/cmd-alert/target/cmd_alert.jar" && \
|
| 70 |
+
wget -O /opt/server/bungee/modules/cmd_find.jar \
|
| 71 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/cmd-find/target/cmd_find.jar" && \
|
| 72 |
+
wget -O /opt/server/bungee/modules/cmd_list.jar \
|
| 73 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/cmd-list/target/cmd_list.jar" && \
|
| 74 |
+
wget -O /opt/server/bungee/modules/cmd_send.jar \
|
| 75 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/cmd-send/target/cmd_send.jar" && \
|
| 76 |
+
wget -O /opt/server/bungee/modules/cmd_server.jar \
|
| 77 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/cmd-server/target/cmd_server.jar" && \
|
| 78 |
+
wget -O /opt/server/bungee/modules/reconnect_yaml.jar \
|
| 79 |
+
"https://ci.md-5.net/job/BungeeCord/1892/artifact/module/reconnect-yaml/target/reconnect_yaml.jar"
|
| 80 |
+
|
| 81 |
+
# WindSpigot
|
| 82 |
+
RUN wget -O /opt/server/backend/server.jar \
|
| 83 |
+
"https://github.com/Wind-Development/WindSpigot/releases/download/v2.1.2-hotfix/WindSpigot-2.1.2.jar"
|
| 84 |
+
|
| 85 |
+
RUN mkdir -p /opt/server/backend/cache && \
|
| 86 |
+
wget -O /opt/server/backend/cache/mojang_1.8.8.jar \
|
| 87 |
+
"https://launcher.mojang.com/v1/objects/5fafba3f58c40dc51b5c3ca72a98f62dfdae1db7/server.jar" || true
|
| 88 |
+
|
| 89 |
+
COPY config/bungee/EaglerXBungee.jar /opt/server/bungee/plugins/EaglerXBungee.jar
|
| 90 |
+
|
| 91 |
+
RUN printf 'server_connect_timeout: 5000\n\
|
| 92 |
+
online_mode: false\n\
|
| 93 |
+
listeners:\n\
|
| 94 |
+
- host: 127.0.0.1:25577\n\
|
| 95 |
+
max_players: 10\n\
|
| 96 |
+
servers:\n\
|
| 97 |
+
lobby:\n\
|
| 98 |
+
address: 127.0.0.1:25565\n\
|
| 99 |
+
motd: Server\n\
|
| 100 |
+
restricted: false\n' > /opt/server/bungee/config.yml
|
| 101 |
+
|
| 102 |
+
RUN echo "eula=true" > /opt/server/backend/eula.txt
|
| 103 |
+
|
| 104 |
+
COPY start.sh /opt/server/start.sh
|
| 105 |
+
RUN chmod +x /opt/server/start.sh
|
| 106 |
+
RUN chmod -R 755 /opt/server
|
| 107 |
+
|
| 108 |
+
EXPOSE 7860
|
| 109 |
+
|
| 110 |
+
CMD ["/opt/server/start.sh"]
|