Dockerfile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ARG DOCKER_IMAGE=alpine:3.16
  2. FROM $DOCKER_IMAGE AS builder
  3. ENV MINETEST_GAME_VERSION master
  4. ENV IRRLICHT_VERSION master
  5. ENV SPATIALINDEX_VERSION 1.9.3
  6. ENV LUAJIT_VERSION v2.1
  7. RUN apk add --no-cache git build-base cmake curl-dev zlib-dev zstd-dev \
  8. sqlite-dev postgresql-dev hiredis-dev leveldb-dev \
  9. gmp-dev jsoncpp-dev ninja ca-certificates
  10. WORKDIR /usr/src/
  11. RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \
  12. cd prometheus-cpp && \
  13. cmake -B build \
  14. -DCMAKE_INSTALL_PREFIX=/usr/local \
  15. -DCMAKE_BUILD_TYPE=Release \
  16. -DENABLE_TESTING=0 \
  17. -GNinja && \
  18. cmake --build build && \
  19. cmake --install build && \
  20. cd /usr/src/ && \
  21. git clone --recursive https://github.com/libspatialindex/libspatialindex -b ${SPATIALINDEX_VERSION} && \
  22. cd libspatialindex && \
  23. cmake -B build \
  24. -DCMAKE_INSTALL_PREFIX=/usr/local && \
  25. cmake --build build && \
  26. cmake --install build && \
  27. cd /usr/src/ && \
  28. git clone --recursive https://luajit.org/git/luajit.git -b ${LUAJIT_VERSION} && \
  29. cd luajit && \
  30. make && make install && \
  31. cd /usr/src/ && \
  32. git clone --depth=1 https://github.com/minetest/irrlicht/ -b ${IRRLICHT_VERSION} && \
  33. cp -r irrlicht/include /usr/include/irrlichtmt
  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 git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \
  49. rm -fr ./games/minetest_game/.git && \
  50. cmake -B build \
  51. -DCMAKE_INSTALL_PREFIX=/usr/local \
  52. -DCMAKE_BUILD_TYPE=Release \
  53. -DBUILD_SERVER=TRUE \
  54. -DENABLE_PROMETHEUS=TRUE \
  55. -DBUILD_UNITTESTS=FALSE \
  56. -DBUILD_CLIENT=FALSE \
  57. -GNinja && \
  58. cmake --build build && \
  59. cmake --install build
  60. ARG DOCKER_IMAGE=alpine:3.16
  61. FROM $DOCKER_IMAGE AS runtime
  62. RUN apk add --no-cache curl gmp libstdc++ libgcc libpq jsoncpp zstd-libs \
  63. sqlite-libs postgresql hiredis leveldb && \
  64. adduser -D minetest --uid 30000 -h /var/lib/minetest && \
  65. chown -R minetest:minetest /var/lib/minetest
  66. WORKDIR /var/lib/minetest
  67. COPY --from=builder /usr/local/share/minetest /usr/local/share/minetest
  68. COPY --from=builder /usr/local/bin/minetestserver /usr/local/bin/minetestserver
  69. COPY --from=builder /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
  70. COPY --from=builder /usr/local/lib/libspatialindex* /usr/local/lib/
  71. COPY --from=builder /usr/local/lib/libluajit* /usr/local/lib/
  72. USER minetest:minetest
  73. EXPOSE 30000/udp 30000/tcp
  74. VOLUME /var/lib/minetest/ /etc/minetest/
  75. ENTRYPOINT ["/usr/local/bin/minetestserver"]
  76. CMD ["--config", "/etc/minetest/minetest.conf"]