Dockerfile 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ARG DOCKER_IMAGE=alpine:3.16
  2. FROM $DOCKER_IMAGE AS dev
  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. FROM dev as builder
  35. COPY .git /usr/src/minetest/.git
  36. COPY CMakeLists.txt /usr/src/minetest/CMakeLists.txt
  37. COPY README.md /usr/src/minetest/README.md
  38. COPY minetest.conf.example /usr/src/minetest/minetest.conf.example
  39. COPY builtin /usr/src/minetest/builtin
  40. COPY cmake /usr/src/minetest/cmake
  41. COPY doc /usr/src/minetest/doc
  42. COPY fonts /usr/src/minetest/fonts
  43. COPY lib /usr/src/minetest/lib
  44. COPY misc /usr/src/minetest/misc
  45. COPY po /usr/src/minetest/po
  46. COPY src /usr/src/minetest/src
  47. COPY textures /usr/src/minetest/textures
  48. WORKDIR /usr/src/minetest
  49. RUN git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \
  50. rm -fr ./games/minetest_game/.git && \
  51. cmake -B build \
  52. -DCMAKE_INSTALL_PREFIX=/usr/local \
  53. -DCMAKE_BUILD_TYPE=Release \
  54. -DBUILD_SERVER=TRUE \
  55. -DENABLE_PROMETHEUS=TRUE \
  56. -DBUILD_UNITTESTS=FALSE \
  57. -DBUILD_CLIENT=FALSE \
  58. -GNinja && \
  59. cmake --build build && \
  60. cmake --install build
  61. ARG DOCKER_IMAGE=alpine:3.16
  62. FROM $DOCKER_IMAGE AS runtime
  63. RUN apk add --no-cache curl gmp libstdc++ libgcc libpq jsoncpp zstd-libs \
  64. sqlite-libs postgresql hiredis leveldb && \
  65. adduser -D minetest --uid 30000 -h /var/lib/minetest && \
  66. chown -R minetest:minetest /var/lib/minetest
  67. WORKDIR /var/lib/minetest
  68. COPY --from=builder /usr/local/share/minetest /usr/local/share/minetest
  69. COPY --from=builder /usr/local/bin/minetestserver /usr/local/bin/minetestserver
  70. COPY --from=builder /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
  71. COPY --from=builder /usr/local/lib/libspatialindex* /usr/local/lib/
  72. COPY --from=builder /usr/local/lib/libluajit* /usr/local/lib/
  73. USER minetest:minetest
  74. EXPOSE 30000/udp 30000/tcp
  75. VOLUME /var/lib/minetest/ /etc/minetest/
  76. ENTRYPOINT ["/usr/local/bin/minetestserver"]
  77. CMD ["--config", "/etc/minetest/minetest.conf"]