minecraft-server / Dockerfile
Nowa998's picture
Update Dockerfile
88d2339 verified
Raw History Blame Contribute Delete
1.11 kB
FROM debian:12
RUN apt update && apt install -y wget curl openssh-server openjdk-17-jre-headless socat gpg
# 设置 SSH
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "root:eren" | chpasswd
# 安装 Playit.gg
RUN curl -SsL https://playit-cloud.github.io/ppa/key.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/playit.gpg >/dev/null
RUN echo "deb [signed-by=/etc/apt/trusted.gpg.d/playit.gpg] https://playit-cloud.github.io/ppa/data ./" | tee /etc/apt/sources.list.d/playit-cloud.list
RUN apt update && apt install -y playit
# 创建启动脚本
RUN mkdir -p /app
RUN echo '#!/bin/bash' > /app/start.sh
RUN echo 'service ssh start' >> /app/start.sh
RUN echo 'echo "Starting Playit.gg agent with secret key..."' >> /app/start.sh
RUN echo 'playit --secret $PLAYIT_SECRET &' >> /app/start.sh
RUN echo 'sleep 5' >> /app/start.sh
RUN echo 'echo "Setting up UDP to TCP forwarding for SSH..."' >> /app/start.sh
RUN echo 'socat UDP4-LISTEN:2222,fork TCP4:localhost:22 &' >> /app/start.sh
RUN echo 'tail -f /dev/null' >> /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 22 2222
CMD ["/app/start.sh"]