Skip to content

Create Docker container setup for the project #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions alignment.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# syntax=docker/dockerfile:1
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
RUN <<EOF
# build SDL2
# define installation directory
mkdir SDL2
export SDL2_INSTALLATION=/SDL2
# clone SDL
apt-get update -y
apt install -y git build-essential
git clone https://github.com/libsdl-org/SDL.git -b SDL2 && cd SDL && git checkout tags/release-2.26.2
# build
mkdir build && cd build && ../configure --prefix=$SDL2_INSTALLATION --enable-video-offscreen && make && make install
EOF

RUN <<EOF
# build Irrlicht
# install missing dependency
apt-get update -y
apt install -y zlib1g-dev libjpeg-dev libpng-dev libxi-dev cmake
# clone irrlicht
git clone https://github.com/EleutherAI/irrlicht && cd irrlicht && git checkout disable-x11
# define lib paths
export SDL2_INSTALLATION=/SDL2
# build
cmake . -DBUILD_SHARED_LIBS=OFF -DBUILD_HEADLESS=1 -DSDL2_DIR=$SDL2_INSTALLATION/lib/cmake/SDL2
make -j8
EOF

RUN <<EOF
# build minetest
# install dependencies
apt-get update -y
apt install -y libzmqpp-dev libgmp3-dev protobuf-compiler libprotobuf-dev libzstd-dev libfreetype-dev libsqlite3-dev
# clone minetest fork
git clone https://github.com/EleutherAI/minetest
git clone --depth 1 https://github.com/minetest/minetest_game.git minetest/games/minetest_game
cd minetest
git checkout cmake-SDL2-target-fix
# compile protobuf
cd hacking_testing
./compile_proto.sh
cd ..
# define lib paths
export SDL2_INSTALLATION=/SDL2
export IRRLICHT_REPO=/irrlicht
# build
cd minetest
cmake . -B build_headless_render -DCMAKE_BUILD_TYPE=Debug -DSDL2_DIR=$SDL2_INSTALLATION/lib/cmake/SDL2 -DIRRLICHTMT_BUILD_DIR=$IRRLICHT_REPO -DBUILD_HEADLESS=1 -DENABLE_SOUND=OFF -DRUN_IN_PLACE=1
cmake --build build_headless_render
EOF

RUN <<EOF
# Install Python packages and Xvfb
apt-get install -y python3 python3-pip xvfb
pip install numpy matplotlib gym zmq protobuf
EOF

WORKDIR minetest
EXPOSE 30000
CMD ["hacking_testing/server.sh"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this got me wondering, will we need a separate Dockerfile for clients?
If this is specifically for running a server then we actually don't need to build with SDL at all.
On the other hand, I guess initially we will have server and client(s) running on the same machine, maybe even the same docker container..
So in case of a single Dockerfile it probably would make sense to not hardcode the entry point here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMD is just a default, we could make a cli with support for the different options as an entry point maybe?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that sounds good. even simpler: optionally pass a any script that is being used as entrypoint