Dockerfile 2.3 KB

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