3c41ce0f491da944cf0b5eda341fb5d7703ce811
[oweals/minetest.git] / Dockerfile
1 FROM alpine:3.11
2
3 ENV MINETEST_GAME_VERSION master
4
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
19 WORKDIR /usr/src/minetest
20
21 RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \
22                 jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \
23                 libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \
24                 gmp-dev jsoncpp-dev postgresql-dev && \
25         git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \
26         rm -fr ./games/minetest_game/.git && \
27         mkdir build && \
28         cd build && \
29         cmake .. \
30                 -DCMAKE_INSTALL_PREFIX=/usr/local \
31                 -DCMAKE_BUILD_TYPE=Release \
32                 -DBUILD_SERVER=TRUE \
33                 -DBUILD_CLIENT=FALSE && \
34         make -j2 && \
35         make install
36
37 FROM alpine:3.11
38
39 RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq && \
40         adduser -D minetest --uid 30000 -h /var/lib/minetest && \
41         chown -R minetest:minetest /var/lib/minetest
42
43 WORKDIR /var/lib/minetest
44
45 COPY --from=0 /usr/local/share/minetest /usr/local/share/minetest
46 COPY --from=0 /usr/local/bin/minetestserver /usr/local/bin/minetestserver
47 COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
48
49 USER minetest:minetest
50
51 EXPOSE 30000/udp
52
53 CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"]