Download Dockerfile from nazib61/mcserver: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/nazib61/mcserver/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/nazib61/mcserver/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/nazib61/mcserver/resolve/main/Dockerfile
1.28 kB
| FROM openjdk:21-jdk-slim | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # essentials | |
| RUN apt-get update && apt-get install -y wget curl unzip jq ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # make server dir writable | |
| RUN mkdir -p /server && chmod -R a+rwx /server | |
| WORKDIR /server | |
| # Download latest playit agent binary (amd64) from GitHub releases (redirect) | |
| RUN curl -L -o /server/playit https://github.com/playit-cloud/playit-agent/releases/latest/download/playit-linux-amd64 \ | |
| && chmod +x /server/playit | |
| # Fetch latest Minecraft release and download server.jar | |
| RUN set -eux; \ | |
| MANIFEST_URL="https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"; \ | |
| MANIFEST_JSON="$(curl -sS "${MANIFEST_URL}")"; \ | |
| LATEST_VER="$(printf '%s' "${MANIFEST_JSON}" | jq -r '.latest.release')"; \ | |
| VERSION_URL="$(printf '%s' "${MANIFEST_JSON}" | jq -r --arg v "${LATEST_VER}" '.versions[] | select(.id==$v) | .url')"; \ | |
| curl -sSf "${VERSION_URL}" -o version.json; \ | |
| SERVER_JAR_URL="$(jq -r '.downloads.server.url' version.json)"; \ | |
| wget -O /server/server.jar "${SERVER_JAR_URL}"; \ | |
| rm -f version.json | |
| # Accept EULA | |
| RUN echo "eula=true" > /server/eula.txt | |
| EXPOSE 25565 | |
| COPY start.sh /server/start.sh | |
| RUN chmod +x /server/start.sh | |
| CMD ["/server/start.sh"] | |