27734119e40c23bfeddda5c8f340a2698d0c276f
[oweals/minetest.git] / Dockerfile
1 FROM debian:stretch
2
3 USER root
4 RUN apt-get update -y && \
5         apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev \
6                 libsqlite3-dev libcurl4-gnutls-dev zlib1g-dev libgmp-dev libjsoncpp-dev git && \
7                 apt-get clean && rm -rf /var/cache/apt/archives/* && \
8                 rm -rf /var/lib/apt/lists/*
9
10 COPY . /usr/src/minetest
11
12 RUN     mkdir -p /usr/src/minetest/cmakebuild && cd /usr/src/minetest/cmakebuild && \
13         cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE \
14                 -DBUILD_SERVER=TRUE \
15                 -DBUILD_CLIENT=FALSE \
16                 -DENABLE_SYSTEM_JSONCPP=1 \
17                 .. && \
18                 make -j2 && \
19                 rm -Rf ../games/minetest_game && git clone https://github.com/minetest/minetest_game ../games/minetest_game && \
20                 make install
21
22 FROM debian:stretch
23
24 USER root
25 RUN groupadd minetest && useradd -m -g minetest -d /var/lib/minetest minetest && \
26     apt-get update -y && \
27     apt-get -y install libcurl3-gnutls libjsoncpp1 liblua5.1-0 libluajit-5.1-2 libpq5 libsqlite3-0 \
28         libstdc++6 zlib1g libc6
29
30 WORKDIR /var/lib/minetest
31
32 COPY --from=0 /usr/local/share/minetest /usr/local/share/minetest
33 COPY --from=0 /usr/local/bin/minetestserver /usr/local/bin/minetestserver
34 COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
35
36 USER minetest
37
38 EXPOSE 30000/udp
39
40 CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"]