Dockerfile 2.6 KB

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