2
0

Dockerfile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ARG DOCKER_IMAGE=alpine:3.19
  2. FROM $DOCKER_IMAGE AS dev
  3. ENV IRRLICHT_VERSION master
  4. ENV SPATIALINDEX_VERSION master
  5. ENV LUAJIT_VERSION v2.1
  6. RUN apk add --no-cache git build-base cmake curl-dev zlib-dev zstd-dev \
  7. sqlite-dev postgresql-dev hiredis-dev leveldb-dev \
  8. gmp-dev jsoncpp-dev ninja ca-certificates
  9. WORKDIR /usr/src/
  10. RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp && \
  11. cd prometheus-cpp && \
  12. cmake -B build \
  13. -DCMAKE_INSTALL_PREFIX=/usr/local \
  14. -DCMAKE_BUILD_TYPE=Release \
  15. -DENABLE_TESTING=0 \
  16. -GNinja && \
  17. cmake --build build && \
  18. cmake --install build && \
  19. cd /usr/src/ && \
  20. git clone --recursive https://github.com/libspatialindex/libspatialindex -b ${SPATIALINDEX_VERSION} && \
  21. cd libspatialindex && \
  22. cmake -B build \
  23. -DCMAKE_INSTALL_PREFIX=/usr/local && \
  24. cmake --build build && \
  25. cmake --install build && \
  26. cd /usr/src/ && \
  27. git clone --recursive https://luajit.org/git/luajit.git -b ${LUAJIT_VERSION} && \
  28. cd luajit && \
  29. make amalg && make install && \
  30. cd /usr/src/ && \
  31. git clone --depth=1 https://github.com/minetest/irrlicht -b ${IRRLICHT_VERSION} && \
  32. cp -r irrlicht/include /usr/include/irrlichtmt
  33. FROM dev as builder
  34. COPY .git /usr/src/minetest/.git
  35. COPY CMakeLists.txt /usr/src/minetest/CMakeLists.txt
  36. COPY README.md /usr/src/minetest/README.md
  37. COPY minetest.conf.example /usr/src/minetest/minetest.conf.example
  38. COPY builtin /usr/src/minetest/builtin
  39. COPY cmake /usr/src/minetest/cmake
  40. COPY doc /usr/src/minetest/doc
  41. COPY fonts /usr/src/minetest/fonts
  42. COPY lib /usr/src/minetest/lib
  43. COPY misc /usr/src/minetest/misc
  44. COPY po /usr/src/minetest/po
  45. COPY src /usr/src/minetest/src
  46. COPY textures /usr/src/minetest/textures
  47. WORKDIR /usr/src/minetest
  48. RUN cmake -B build \
  49. -DCMAKE_INSTALL_PREFIX=/usr/local \
  50. -DCMAKE_BUILD_TYPE=Release \
  51. -DBUILD_SERVER=TRUE \
  52. -DENABLE_PROMETHEUS=TRUE \
  53. -DBUILD_UNITTESTS=FALSE -DBUILD_BENCHMARKS=FALSE \
  54. -DBUILD_CLIENT=FALSE \
  55. -GNinja && \
  56. cmake --build build && \
  57. cmake --install build
  58. FROM $DOCKER_IMAGE AS runtime
  59. RUN apk add --no-cache curl gmp libstdc++ libgcc libpq jsoncpp zstd-libs \
  60. sqlite-libs postgresql hiredis leveldb && \
  61. adduser -D minetest --uid 30000 -h /var/lib/minetest && \
  62. chown -R minetest:minetest /var/lib/minetest
  63. WORKDIR /var/lib/minetest
  64. COPY --from=builder /usr/local/share/minetest /usr/local/share/minetest
  65. COPY --from=builder /usr/local/bin/minetestserver /usr/local/bin/minetestserver
  66. COPY --from=builder /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
  67. COPY --from=builder /usr/local/lib/libspatialindex* /usr/local/lib/
  68. COPY --from=builder /usr/local/lib/libluajit* /usr/local/lib/
  69. USER minetest:minetest
  70. EXPOSE 30000/udp 30000/tcp
  71. VOLUME /var/lib/minetest/ /etc/minetest/
  72. ENTRYPOINT ["/usr/local/bin/minetestserver"]
  73. CMD ["--config", "/etc/minetest/minetest.conf"]