Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
complete minetest server dockerfile
FROM ubuntu:latest
RUN apt update && apt install build-essential cmake wget libirrlicht-dev libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev -y
RUN wget https://github.com/minetest/minetest/archive/master.tar.gz && tar xf master.tar.gz && mv minetest-master ./minetest && rm master.tar.gz
RUN wget https://github.com/minetest/minetest_game/archive/master.tar.gz && tar xf master.tar.gz && mv minetest_game-master ./minetest/games/minetest_game && rm master.tar.gz
WORKDIR /minetest
RUN cmake . -DRUN_IN_PLACE=TRUE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE
RUN make -j $(nproc)
VOLUME /minetest/bin/debug.txt
VOLUME /minetest/minetest.conf
VOLUME /minetest/mods
VOLUME /minetest/games
VOLUME /minetest/worlds
EXPOSE 30000/udp
ENTRYPOINT ["/minetest/bin/minetestserver"]
CMD [""]
@limitedAtonement

This comment has been minimized.

Copy link

@limitedAtonement limitedAtonement commented Apr 5, 2020

Here's another using multistage build. It creates a smaller runtime image:

FROM ubuntu:latest as build
run apt-get update
RUN apt-get install libbz2-1.0 libirrlicht1.8 libpng16-16 libjpeg8 libxxf86vm1 libgl1-mesa-glx libsqlite3-0 libogg0 libvorbis0a libopenal1 libcurl3-gnutls libfreetype6 zlib1g libgmp10 libjsoncpp1 -y
RUN apt-get install build-essential cmake wget libirrlicht-dev libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev -y
RUN wget https://github.com/minetest/minetest/archive/master.tar.gz && tar xf master.tar.gz && mv minetest-master ./minetest && rm master.tar.gz
RUN wget https://github.com/minetest/minetest_game/archive/master.tar.gz && tar xf master.tar.gz && mv minetest_game-master ./minetest/games/minetest_game && rm master.tar.gz
WORKDIR /minetest
RUN cmake ../minetest -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_CLIENT=0 -DBUILD_SERVER=1 \
        -DENABLE_LEVELDB=0 -DENABLE_POSTGRESQL=0 \
        -DENABLE_SPATIAL=1 -DENABLE_REDIS=0
run make -j $(nproc) DESTDIR="/minetest-dist" install

FROM ubuntu:latest
RUN apt-get update
RUN apt-get install libbz2-1.0 libirrlicht1.8 libpng16-16 libjpeg8 libxxf86vm1 libgl1-mesa-glx libsqlite3-0 libogg0 libvorbis0a libopenal1 libcurl3-gnutls libfreetype6 zlib1g libgmp10 libjsoncpp1 -y
copy --from=build /minetest-dist/usr/ /
VOLUME /bin/debug.txt
VOLUME /minetest.conf
VOLUME /mods
VOLUME /games
VOLUME /worlds
EXPOSE 30000/udp
ENTRYPOINT ["minetestserver"]
CMD [""]

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.