1
0

fix dockerfile, tune up and setup proper dockerfile with all features

* you can build from dockerfile with `docker build -t mc .`
* later run with `docker run -p 40000:40000/udp -p 40000:40000/tcp -i -t mc`
* The docker by default copy the game from minenux and runs 40000 port
* fixed https://codeberg.org/minenux/minetest-engine-multicraft2/issues/52
  cos already provides linux support with all features (but by docker, puach)
* closes https://github.com/MultiCraft/MultiCraft/issues/59
This commit is contained in:
mckaygerhard 2024-06-04 17:46:28 -04:00
parent 532c187d83
commit 94262d3bc1
2 changed files with 21 additions and 60 deletions

View File

@ -1,68 +1,29 @@
FROM alpine:3.14
ENV MINETEST_GAME_VERSION master
COPY .git /usr/src/multicraft/.git
COPY CMakeLists.txt /usr/src/multicraft/CMakeLists.txt
COPY README.md /usr/src/multicraft/README.md
COPY multicraft.conf.example /usr/src/multicraft/multicraft.conf.example
COPY builtin /usr/src/multicraft/builtin
COPY cmake /usr/src/multicraft/cmake
COPY doc /usr/src/multicraft/doc
COPY fonts /usr/src/multicraft/fonts
COPY lib /usr/src/multicraft/lib
COPY misc /usr/src/multicraft/misc
COPY po /usr/src/multicraft/po
COPY src /usr/src/multicraft/src
COPY textures /usr/src/multicraft/textures
WORKDIR /usr/src/multicraft
RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \
jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \
libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \
gmp-dev jsoncpp-dev postgresql-dev luajit-dev ca-certificates && \
git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \
rm -fr ./games/minetest_game/.git
WORKDIR /usr/src/
RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \
mkdir prometheus-cpp/build && \
cd prometheus-cpp/build && \
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=0 && \
make -j2 && \
make install
FROM alpine:3.18
RUN apk add --no-cache git build-base cmake pkgconf gettext-dev bzip2-dev curl-dev libnl3-dev rtmpdump-dev libidn-dev ncurses-dev freetype-dev mesa-dev gmp-dev irrlicht-dev libjpeg-turbo-dev jsoncpp-dev leveldb-dev luajit-dev lua5.1-dev libogg-dev openal-soft-dev libpng-dev postgresql-dev hiredis-dev sqlite-dev libvorbis-dev libxi-dev zlib-dev doxygen libxrandr-dev libx11-dev zstd-dev openssl-dev samurai
WORKDIR /usr/src
RUN cd /usr/src && \
git clone --depth=1 -b minenux https://gitlab.com/minenux/minetest-engine-multicraft2 multicraft && \
cd multicraft && \
git clone --depth=1 -b stable-5.2 https://codeberg.org/minenux/minetest-game-minetest ./games/minetest && \
rm -fr ./games/minetest/.git
WORKDIR /usr/src/multicraft
RUN mkdir build && \
cd build && \
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SERVER=TRUE \
-DENABLE_PROMETHEUS=TRUE \
-DBUILD_UNITTESTS=FALSE \
-DBUILD_CLIENT=FALSE && \
make -j2 && \
-DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DRUN_IN_PLACE=OFF -DENABLE_CURL=ON -DENABLE_SOUND=ON -DENABLE_LUAJIT=ON -DENABLE_GETTEXT=ON -DENABLE_FREETYPE=ON -DENABLE_SYSTEM_GMP=ON -DENABLE_SYSTEM_JSONCPP=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_POSTGRESQL=ON \
-DRUN_IN_PLACE=OFF -DCUSTOM_BINDIR=/usr/games -DCUSTOM_LOCALEDIR=/usr/share/locale -DCUSTOM_SHAREDIR=/usr/share/games/multicraft -DCUSTOM_EXAMPLE_CONF_DIR=/etc/multicraft .. \
make && \
make install
FROM alpine:3.14
RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit && \
adduser -D multicraft --uid 30000 -h /var/lib/multicraft && \
chown -R multicraft:multicraft /var/lib/multicraft
WORKDIR /var/lib/multicraft
COPY --from=0 /usr/local/share/multicraft /usr/local/share/multicraft
COPY --from=0 /usr/local/bin/multicraftserver /usr/local/bin/multicraftserver
COPY --from=0 /usr/local/share/doc/multicraft/multicraft.conf.example /etc/multicraft/multicraft.conf
FROM alpine:3.18
RUN apk add --no-cache libstdc++ libgcc bzip2 curl libnl3 librtmp libidn libintl libncursesw freetype mesa-gl gmp irrlicht libjpeg-turbo jsoncpp leveldb luajit lua5.1 libogg openal-soft-libs libpng libpq hiredis sqlite-libs libvorbis libxi zlib-dev libxrandr libx11 zstd && \
mkdir -p /var/games/multicraft && adduser -D multicraft --uid 30000 -h /var/games/multicraft && chown -R multicraft:multicraft /var/games/multicraft
COPY --from=0 /usr/share/games/multicraft /usr/share/games/multicraft
COPY --from=0 /usr/games/multicraftserver /usr/games/multicraftserver
COPY --from=0 /etc/multicraft/multicraft.conf /etc/multicraft/multicraft.conf
USER multicraft:multicraft
EXPOSE 30000/udp 30000/tcp
CMD ["/usr/local/bin/multicraftserver", "--config", "/etc/multicraft/multicraft.conf"]
EXPOSE 40000/udp 40000/tcp
WORKDIR /var/games/multicraft
CMD ["/usr/games/multicraftserver", "--port", "40000", "--config", "/etc/multicraft/multicraft.conf", "--gameid", "minetest", "--world", "minetest"]

View File

@ -393,7 +393,7 @@ void set_default_settings()
settings->setDefault("max_simultaneous_block_sends_per_client", "40");
settings->setDefault("time_send_interval", "5");
settings->setDefault("default_game", "default");
settings->setDefault("default_game", "minetest");
settings->setDefault("motd", "");
settings->setDefault("max_users", "15");
settings->setDefault("creative_mode", "false");