Dockerfile 2.7 KB

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