-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
74 lines (52 loc) · 2.35 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM python:3.12-slim-bullseye as base
LABEL maintainer="Endstone <hello@endstone.dev>"
ENV PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8
FROM base AS builder
ARG LLVM_VERSION=15
RUN apt-get update -y -qq \
&& apt-get install -y -qq build-essential lsb-release wget software-properties-common gnupg \
&& wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh ${LLVM_VERSION} \
&& apt-get install -y -qq libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 \
&& update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
ENV CC=clang \
CXX=clang++
ARG CMAKE_VERSION=3.26.6
ARG CMAKE_SH=cmake-${CMAKE_VERSION}-linux-x86_64.sh
RUN apt-get update -y -qq \
&& apt-get install -y -qq wget \
&& wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_SH} \
&& chmod +x ${CMAKE_SH} \
&& ./${CMAKE_SH} --skip-license --exclude-subdir --prefix=/usr/local
RUN apt-get update -y -qq \
&& apt-get install -y -qq git ninja-build
WORKDIR /usr/src/endstone
RUN git clone https://github.com/EndstoneMC/endstone.git .
RUN python -m pip install --upgrade pip \
&& pip install wheel auditwheel setuptools "patchelf>=0.14" pytest \
&& python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose \
&& python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w dist wheelhouse/*.whl \
&& pip install dist/*-manylinux_2_31_x86_64.whl \
&& pytest python/tests
FROM base AS final
RUN apt-get update -y -qq \
&& apt-get install -y -qq curl \
&& apt-get clean -y -qq \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash endstone \
&& printf "endstone:endstone" | chpasswd \
&& adduser endstone sudo \
&& printf "endstone ALL= NOPASSWD: ALL\\n" >> /etc/sudoers
WORKDIR /home/endstone
COPY --from=builder /usr/src/endstone/dist .
RUN python -m pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir ./*-manylinux_2_31_x86_64.whl \
&& rm ./*.whl
USER endstone
EXPOSE 19132/udp 19133/udp
CMD ["endstone"]