Created
December 29, 2024 10:37
-
-
Save takenorio/4763ee1723b554cf3ac275a4668dddc5 to your computer and use it in GitHub Desktop.
BedrockサーバーのDockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:bookworm-slim AS builder | |
WORKDIR /work | |
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | |
ARG USER_AGENT='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' | |
ARG DOWNLOAD_URL='https://www.minecraft.net/en-us/download/server/bedrock' | |
ARG REGEX_PATTERN='https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-[^/]+\.zip' | |
RUN apt-get -qq update \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends \ | |
ca-certificates=* \ | |
curl=7.88.1-* \ | |
unzip=6.0-* \ | |
&& curl -sSA "$USER_AGENT" "$DOWNLOAD_URL" \ | |
| grep -Eo "$REGEX_PATTERN" \ | |
| xargs curl -sSOA "$USER_AGENT" \ | |
&& unzip -q bedrock-server-*.zip -d bedrock-server \ | |
&& mkdir /work/lib{,64} \ | |
&& ldd /work/bedrock-server/bedrock_server \ | |
| grep -oP '(?<= => )\S+?(?= \()' \ | |
| xargs -I{} cp {} /work/lib \ | |
&& cp /lib64/ld-linux-x86-64.so.2 /work/lib64 | |
FROM gcr.io/distroless/static-debian12:nonroot | |
WORKDIR /bedrock-server | |
COPY --from=builder /work/bedrock-server/ /bedrock-server | |
COPY --from=builder /work/lib/ /lib | |
COPY --from=builder /work/lib64/ /lib64 | |
EXPOSE 19132/udp | |
EXPOSE 19133/udp | |
ENTRYPOINT ["/bedrock-server/bedrock_server"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment