chore(docker): use prebuild binaries

This commit is contained in:
Alexander Medvedev 2026-09-01 08:59:58 +02:00
parent 99989ba3b6
commit 0d58f3bfca
4 changed files with 73 additions and 30 deletions

50
Cargo.lock generated
View File

@ -877,6 +877,16 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" 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]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.10.1" version = "0.10.1"
@ -2193,9 +2203,11 @@ dependencies = [
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2",
"system-configuration",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
"windows-registry",
] ]
[[package]] [[package]]
@ -4008,6 +4020,7 @@ checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"bytes", "bytes",
"encoding_rs",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
@ -4020,6 +4033,7 @@ dependencies = [
"hyper-util", "hyper-util",
"js-sys", "js-sys",
"log", "log",
"mime",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"quinn", "quinn",
@ -4505,7 +4519,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
dependencies = [ dependencies = [
"core-foundation", "core-foundation 0.10.1",
"core-foundation-sys", "core-foundation-sys",
"jni", "jni",
"log", "log",
@ -4634,7 +4648,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [ dependencies = [
"bitflags 2.13.1", "bitflags 2.13.1",
"core-foundation", "core-foundation 0.10.1",
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
"security-framework-sys", "security-framework-sys",
@ -5009,6 +5023,27 @@ dependencies = [
"windows", "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]] [[package]]
name = "target-lexicon" name = "target-lexicon"
version = "0.13.5" version = "0.13.5"
@ -6185,6 +6220,17 @@ dependencies = [
"windows-link", "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]] [[package]]
name = "windows-result" name = "windows-result"
version = "0.4.1" version = "0.4.1"

View File

@ -209,7 +209,7 @@ time = { version = "0.3", default-features = false, features = ["std"] }
arc-swap = { version = "1.9", default-features = false } arc-swap = { version = "1.9", default-features = false }
tokio-util = { version = "0.7.19", default-features = false } tokio-util = { version = "0.7.19", default-features = false }
toml = { version = "1.1", default-features = false, features = ["parse", "display", "serde"] } 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"] } notify = { version = "8.2.0", default-features = false, features = ["macos_fsevent"] }
sysinfo = { version = "0.39", default-features = false, features = ["system"] } sysinfo = { version = "0.39", default-features = false, features = ["system"] }

View File

@ -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 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 WORKDIR /pumpkin
USER pumpkin:pumpkin
RUN apk add --no-cache libgcc && chown 2613:2613 .
ENV RUST_BACKTRACE=1 ENV RUST_BACKTRACE=1
EXPOSE 25565 EXPOSE 25565
USER 2613:2613
ENTRYPOINT [ "/bin/pumpkin" ] ENTRYPOINT [ "pumpkin" ]
HEALTHCHECK CMD nc -z 127.0.0.1 25565 || exit 1
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD nc -z 127.0.0.1 25565 || exit 1

View File

@ -6,6 +6,7 @@ services:
build: . build: .
ports: ports:
- "25565:25565" - "25565:25565"
- "19132:19132/udp"
volumes: volumes:
- ./data:/pumpkin - ./data:/pumpkin
# Use the following, if you want to make your config immutable # Use the following, if you want to make your config immutable