diff --git a/Cargo.lock b/Cargo.lock index 208745ca7..7433c3ff6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -877,6 +877,16 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation" version = "0.10.1" @@ -2193,9 +2203,11 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] @@ -4008,6 +4020,7 @@ checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ "base64 0.22.1", "bytes", + "encoding_rs", "futures-channel", "futures-core", "futures-util", @@ -4020,6 +4033,7 @@ dependencies = [ "hyper-util", "js-sys", "log", + "mime", "percent-encoding", "pin-project-lite", "quinn", @@ -4505,7 +4519,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" dependencies = [ - "core-foundation", + "core-foundation 0.10.1", "core-foundation-sys", "jni", "log", @@ -4634,7 +4648,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags 2.13.1", - "core-foundation", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -5009,6 +5023,27 @@ dependencies = [ "windows", ] +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.1", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "target-lexicon" version = "0.13.5" @@ -6185,6 +6220,17 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + [[package]] name = "windows-result" version = "0.4.1" diff --git a/Cargo.toml b/Cargo.toml index 080b8779b..0e3532d35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -209,7 +209,7 @@ time = { version = "0.3", default-features = false, features = ["std"] } arc-swap = { version = "1.9", default-features = false } tokio-util = { version = "0.7.19", default-features = false } toml = { version = "1.1", default-features = false, features = ["parse", "display", "serde"] } -reqwest = { version = "0.13.4", default-features = false, features = ["rustls", "json", "http2"] } +reqwest = { version = "0.13.4", features = ["json"] } notify = { version = "8.2.0", default-features = false, features = ["macos_fsevent"] } sysinfo = { version = "0.39", default-features = false, features = ["system"] } diff --git a/Dockerfile b/Dockerfile index 38e266db3..966cf4d69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,30 @@ -FROM rust:1-alpine3.23 AS builder -ENV RUSTFLAGS="-C target-feature=-crt-static" -RUN apk add --no-cache musl-dev \ - # Required for git-version - git - -WORKDIR /pumpkin -COPY . /pumpkin - -RUN rustup show active-toolchain || rustup toolchain install -RUN rustup component add rustfmt - -# build release -RUN --mount=type=cache,sharing=private,target=/pumpkin/target \ - --mount=type=cache,target=/usr/local/cargo/git/db \ - --mount=type=cache,target=/usr/local/cargo/registry/ \ - cargo build --release -p pumpkin && cp target/release/pumpkin ./pumpkin.release - FROM alpine:3.24 -COPY --from=builder /pumpkin/pumpkin.release /bin/pumpkin +ARG TARGETARCH +ARG PUMPKIN_TAG=nightly + +RUN apk add --no-cache curl ca-certificates && \ + case "${TARGETARCH}" in \ + "amd64") BIN_ARCH="X64" ;; \ + "arm64") BIN_ARCH="ARM64" ;; \ + *) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \ + esac && \ + curl -fsSL "https://github.com/Pumpkin-MC/Pumpkin/releases/download/${PUMPKIN_TAG}/pumpkin-${BIN_ARCH}-Linux-musl" \ + -o /usr/local/bin/pumpkin && \ + chmod +x /usr/local/bin/pumpkin && \ + apk del curl + +RUN addgroup -g 2613 pumpkin && \ + adduser -u 2613 -G pumpkin -D -h /pumpkin pumpkin && \ + chown -R pumpkin:pumpkin /pumpkin -# set workdir to /pumpkin, this is required to influence the PWD environment variable -# it allows for bind mounting the server files without overwriting the pumpkin -# executable (without requiring an `docker cp`-ing the binary to the host folder) WORKDIR /pumpkin - -RUN apk add --no-cache libgcc && chown 2613:2613 . +USER pumpkin:pumpkin ENV RUST_BACKTRACE=1 EXPOSE 25565 -USER 2613:2613 -ENTRYPOINT [ "/bin/pumpkin" ] -HEALTHCHECK CMD nc -z 127.0.0.1 25565 || exit 1 + +ENTRYPOINT [ "pumpkin" ] + +HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ + CMD nc -z 127.0.0.1 25565 || exit 1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 3e421d6fe..1cd3acc9c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: build: . ports: - "25565:25565" + - "19132:19132/udp" volumes: - ./data:/pumpkin # Use the following, if you want to make your config immutable