1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- ARG DOCKER_IMAGE=alpine:3.19
- FROM $DOCKER_IMAGE AS dev
- ENV LUAJIT_VERSION v2.1
- RUN apk add --no-cache git build-base cmake curl-dev zlib-dev zstd-dev \
- sqlite-dev postgresql-dev hiredis-dev leveldb-dev \
- gmp-dev jsoncpp-dev ninja ca-certificates
- WORKDIR /usr/src/
- RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp && \
- cd prometheus-cpp && \
- cmake -B build \
- -DCMAKE_INSTALL_PREFIX=/usr/local \
- -DCMAKE_BUILD_TYPE=Release \
- -DENABLE_TESTING=0 \
- -GNinja && \
- cmake --build build && \
- cmake --install build && \
- cd /usr/src/ && \
- git clone --recursive https://github.com/libspatialindex/libspatialindex && \
- cd libspatialindex && \
- cmake -B build \
- -DCMAKE_INSTALL_PREFIX=/usr/local && \
- cmake --build build && \
- cmake --install build && \
- cd /usr/src/ && \
- git clone --recursive https://luajit.org/git/luajit.git -b ${LUAJIT_VERSION} && \
- cd luajit && \
- make amalg && make install && \
- cd /usr/src/
- FROM dev as builder
- COPY .git /usr/src/luanti/.git
- COPY CMakeLists.txt /usr/src/luanti/CMakeLists.txt
- COPY README.md /usr/src/luanti/README.md
- COPY minetest.conf.example /usr/src/luanti/minetest.conf.example
- COPY builtin /usr/src/luanti/builtin
- COPY cmake /usr/src/luanti/cmake
- COPY doc /usr/src/luanti/doc
- COPY fonts /usr/src/luanti/fonts
- COPY lib /usr/src/luanti/lib
- COPY misc /usr/src/luanti/misc
- COPY po /usr/src/luanti/po
- COPY src /usr/src/luanti/src
- COPY irr /usr/src/luanti/irr
- COPY textures /usr/src/luanti/textures
- WORKDIR /usr/src/luanti
- RUN cmake -B build \
- -DCMAKE_INSTALL_PREFIX=/usr/local \
- -DCMAKE_BUILD_TYPE=Release \
- -DBUILD_SERVER=TRUE \
- -DENABLE_PROMETHEUS=TRUE \
- -DBUILD_UNITTESTS=FALSE -DBUILD_BENCHMARKS=FALSE \
- -DBUILD_CLIENT=FALSE \
- -GNinja && \
- cmake --build build && \
- cmake --install build
- FROM $DOCKER_IMAGE AS runtime
- RUN apk add --no-cache curl gmp libstdc++ libgcc libpq jsoncpp zstd-libs \
- sqlite-libs postgresql hiredis leveldb && \
- adduser -D minetest --uid 30000 -h /var/lib/minetest && \
- chown -R minetest:minetest /var/lib/minetest
- WORKDIR /var/lib/minetest
- COPY --from=builder /usr/local/share/luanti /usr/local/share/luanti
- COPY --from=builder /usr/local/bin/luantiserver /usr/local/bin/luantiserver
- COPY --from=builder /usr/local/share/doc/luanti/minetest.conf.example /etc/minetest/minetest.conf
- COPY --from=builder /usr/local/lib/libspatialindex* /usr/local/lib/
- COPY --from=builder /usr/local/lib/libluajit* /usr/local/lib/
- USER minetest:minetest
- EXPOSE 30000/udp 30000/tcp
- VOLUME /var/lib/minetest/ /etc/minetest/
- ENTRYPOINT ["/usr/local/bin/luantiserver"]
- CMD ["--config", "/etc/minetest/minetest.conf"]
|