Dockerfile 2.3 KB

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