From 9142a096dfca1edefa37b55e2a16750c2f4cdc31 Mon Sep 17 00:00:00 2001 From: "David Kennedy S. A" Date: Wed, 21 Mar 2018 01:54:10 -0300 Subject: [PATCH 1/4] Add dockerfile to build ubuntu version --- Dockerfile | 31 +++++++++++++++++++++++++++++++ README.md | 9 +++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e1ba3f5f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +from ubuntu:latest + +WORKDIR /app + +RUN apt-get update; apt-get install -y \ + build-essential \ + cmake \ + git-core \ + libboost-all-dev \ + libglew-dev \ + liblua5.1-0-dev \ + libopenal-dev \ + libphysfs-dev \ + libssl-dev \ + libvorbis-dev \ + zlib1g-dev + +RUN apt-get install -y \ + libncurses5-dev \ + mercurial; \ + hg clone -r stable-2.0 http://hg.icculus.org/icculus/physfs/; \ + cd physfs; \ + mkdir build && cd build && cmake .. && make && make install; \ + mv /usr/local/lib/libphysfs.a /usr/lib/x86_64-linux-gnu/. + +ADD . /app + +# Build application +RUN mkdir -p build && cd build && cmake .. && make -j$(grep -c ^process /proc/cpuinfo); + +CMD cd build; ./otclient diff --git a/README.md b/README.md index 12b5edab..afa529ef 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,15 @@ In short, if you need to compile OTClient, follow these tutorials: * [Compiling on Linux](https://github.com/edubart/otclient/wiki/Compiling-on-Linux) * [Compiling on OS X](https://github.com/edubart/otclient/wiki/Compiling-on-Mac-OS-X) +### Build and run with Docker + +To build and run the client without copile by hand: +``` +./build.sh +./run.sh +``` + +The build step should be run just when something on implementation changes. ### Need help? From 934513df80854277a1bba950a8470d204971fa6b Mon Sep 17 00:00:00 2001 From: "David Kennedy S. A" Date: Wed, 21 Mar 2018 01:55:51 -0300 Subject: [PATCH 2/4] Build and run with docker container --- build.sh | 3 +++ run.sh | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100755 build.sh create mode 100755 run.sh diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..35ce50fd --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker build -t edubart/otclient . diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..aaac1c5e --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +docker run -ti --rm \ + -e DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + --device /dev/dri \ + edubart/otclient From 251c937b7e5602592e60576e3f4fa1bc2ea4a44f Mon Sep 17 00:00:00 2001 From: "David Kennedy S. A" Date: Wed, 21 Mar 2018 01:56:38 -0300 Subject: [PATCH 3/4] Disable SE Linux when running the client on container --- run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.sh b/run.sh index aaac1c5e..4eead955 100755 --- a/run.sh +++ b/run.sh @@ -1,7 +1,13 @@ #!/usr/bin/env bash +SE_enforcing=`getenforce` || true + +sudo setenforce Permissive || true + docker run -ti --rm \ -e DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ --device /dev/dri \ edubart/otclient + +sudo setenforce $SE_enforcing || true From d03ffc1f26be3171a3673fa73fedb85664ab6cad Mon Sep 17 00:00:00 2001 From: "David Kennedy S. A" Date: Wed, 28 Mar 2018 11:57:59 -0300 Subject: [PATCH 4/4] Enable any client connect to X host --- run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.sh b/run.sh index 4eead955..288c22bd 100755 --- a/run.sh +++ b/run.sh @@ -4,10 +4,16 @@ SE_enforcing=`getenforce` || true sudo setenforce Permissive || true +# Enable any host to connect on X Org +xhost + + docker run -ti --rm \ -e DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ --device /dev/dri \ edubart/otclient +# Enable any host to connect on X Org +xhost - + sudo setenforce $SE_enforcing || true