Dockerfile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. cd prometheus-cpp && \
  26. cmake -B build \
  27. -DCMAKE_INSTALL_PREFIX=/usr/local \
  28. -DCMAKE_BUILD_TYPE=Release \
  29. -DENABLE_TESTING=0 \
  30. -GNinja && \
  31. cmake --build build && \
  32. cmake --install build
  33. RUN git clone --depth=1 https://github.com/minetest/irrlicht/ -b ${IRRLICHT_VERSION} && \
  34. cp -r irrlicht/include /usr/include/irrlichtmt
  35. WORKDIR /usr/src/minetest
  36. RUN cmake -B build \
  37. -DCMAKE_INSTALL_PREFIX=/usr/local \
  38. -DCMAKE_BUILD_TYPE=Release \
  39. -DBUILD_SERVER=TRUE \
  40. -DENABLE_PROMETHEUS=TRUE \
  41. -DBUILD_UNITTESTS=FALSE \
  42. -DBUILD_CLIENT=FALSE \
  43. -GNinja && \
  44. cmake --build build && \
  45. cmake --install build
  46. ARG DOCKER_IMAGE=alpine:3.14
  47. FROM $DOCKER_IMAGE AS runtime
  48. RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit jsoncpp zstd-libs && \
  49. adduser -D minetest --uid 30000 -h /var/lib/minetest && \
  50. chown -R minetest:minetest /var/lib/minetest
  51. WORKDIR /var/lib/minetest
  52. COPY --from=builder /usr/local/share/minetest /usr/local/share/minetest
  53. COPY --from=builder /usr/local/bin/minetestserver /usr/local/bin/minetestserver
  54. COPY --from=builder /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
  55. USER minetest:minetest
  56. EXPOSE 30000/udp 30000/tcp
  57. CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"]