DigitalPulseSoftware / BurgWar

Burg'war est un jeu de plateforme/combat multijoueur en 2D écrit en C++17/Lua avec mon propre moteur de jeu : Nazara Engine.
MIT License
52 stars 9 forks source link

ci: make dockerfile in order to compile the game using docker #29

Open SirMishaa opened 4 years ago

SirMishaa commented 4 years ago

Related to issue #28

There are still some errors in the Dockerfile but here is the basis for compiling Nazara.

The Dockerfile will download and compile Nazara and then compile BurgWar.

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

SirMishaa commented 4 years ago

Here are the remaining errors :

Linking NazaraUnitTestsServer
Model.cpp
/usr/bin/ld: ../../../lib/gmake/x64/libNazaraPhysics3D-d.so: undefined reference to `__atan2_finite'
/usr/bin/ld: ../../../lib/gmake/x64/libNazaraPhysics3D-d.so: undefined reference to `__asin_finite'
/usr/bin/ld: ../../../lib/gmake/x64/libNazaraPhysics3D-d.so: undefined reference to `__acosf_finite'
/usr/bin/ld: ../../../lib/gmake/x64/libNazaraPhysics3D-d.so: undefined reference to `__asinf_finite'
/usr/bin/ld: ../../../lib/gmake/x64/libNazaraPhysics3D-d.so: undefined reference to `__acos_finite'
collect2: error: ld returned 1 exit status
make[1]: *** [NazaraUnitTestsServer.make:250: ../../../tests/NazaraUnitTestsServer] Error 1
make: *** [Makefile:311: NazaraUnitTestsServer] Error 2
make: *** Waiting for unfinished jobs....
ParticleController.cpp
ImperatorS79 commented 4 years ago

I have the same error on my PC using ubuntu 20.04, seems it is related to newton lib being too old. However if you use debian buster for your dockerfile it should work like a charm (it works for me).

SirMishaa commented 4 years ago

Thank you, I'll change that.

Fixed in commit 06b0e4c

SirMishaa commented 4 years ago

Nazara now compiles correctly.

I just have to set up the BurgWar compilation, I do that in 30 minutes after eating ;)

SirMishaa commented 4 years ago

The compilation of the BurgWar is finished and should work.

The only problem now is how to ensure that when building the Docker image, the user specify a mount point because the Docker image needs BurgWar to be present to compile it.

In this way :

{# (I'll upload this image on Docker Hub and make a docker-compose file) #}
docker build -t burgwar-image .
docker container run -v /home/SirMishaa/BurgWar:/root/BurgWar/build --name burgwar burgwar-image

So, maybe I should create a script, so I would have the image but without the compilation of the game. And to use it :

docker container run -v /home/SirMishaa/BurgWar:/root/BurgWar/build burgwar-image /bin/compile-burgwar

Something like this ^

@ImperatorS79 If you have any advice

ImperatorS79 commented 3 years ago

Okay so as far as I understand, use this dockerfile:

FROM debian:stable
MAINTAINER SirMishaa

# Update packages and install GCC and git
RUN apt update && apt upgrade -y && apt install build-essential git -y

# Nazara and Burgwar dependencies
RUN apt install libopenal-dev libsndfile1-dev libfreetype6-dev libassimp-dev libsdl2-dev libxcb-ewmh-dev libxcb-keysyms1-dev \
                qtbase5-dev libcurl4-gnutls-dev \
                -y

# Configure env for tzdata
ENV TZ=Europe/Brussels
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Build Nazara

WORKDIR /usr/lib

RUN git clone --depth 1 -b master https://github.com/DigitalPulseSoftware/NazaraEngine

WORKDIR /usr/lib/NazaraEngine/build

RUN ./premake5-linux64 gmake

WORKDIR /usr/lib/NazaraEngine/build/gmake

RUN make -j8

WORKDIR /usr/lib/NazaraEngine/build

RUN ./premake5-linux64 package

Then in a console:

docker build . -t burgwar-image -f docker/Dockerfile
docker container run -v ~/BurgWar:/root/BurgWar/ -itd --name burgwar-container burgwar-image
docker attach burgwar-container

This should build the image with nazara in it, then create a container to which you can attach from the image with your host burgwar folder mounted in it, and then you can attach to your container and execute your build command, but inside the host directory!

Tested just now and working fine ^^.