From b48fb5ff921db471d3d18a7c097f7a7bbbc37ac9 Mon Sep 17 00:00:00 2001 From: Enric Moreu Date: Wed, 16 Jan 2019 15:39:10 +0000 Subject: [PATCH] Docker build automated with Compose --- Dockerfile | 8 +++++--- docker-compose.yml | 14 ++++++++++++++ makefile | 23 ----------------------- readme.md | 2 ++ 4 files changed, 21 insertions(+), 26 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index dabadb6..a80acdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM java:openjdk-7-jdk -RUN mkdir /compile - WORKDIR /compile -CMD [ "./compile.sh" ] +ADD compile.sh /compile/ +ADD rsc/ /compile/rsc +ADD src/ /compile/src + +RUN [ "./compile.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f6ed917 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' + +services: + + graphwar: + image: graphwar + container_name: graphwar + build: + context: . + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + environment: + - DISPLAY=${DISPLAY} + command: java -jar graphwar.jar \ No newline at end of file diff --git a/makefile b/makefile index d0a647d..f703c49 100644 --- a/makefile +++ b/makefile @@ -14,29 +14,6 @@ all: rm -rf GlobalServer rm -rf RoomServer -docker-graphwar: - - ## build graphwar inside of a container - docker run --rm \ - -v ${PWD}:/compile \ - graphwar/build - -docker-image: - - ## build docker image - docker build -t graphwar/build . - -run-client: - - ## run graphwar on a container - docker run --rm \ - -v ${PWD}:/compile \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e DISPLAY=${DISPLAY} \ - --network host \ - graphwar/build \ - java -jar graphwar.jar - clean: rm -r bin diff --git a/readme.md b/readme.md index 874d6cf..2c097cc 100644 --- a/readme.md +++ b/readme.md @@ -103,6 +103,8 @@ Compile the game using the make command (or on your favorite IDE). To run the game execute graphwar.jar. +Alternatively, you can try it with Docker Compose: `docker-compose up` + ## Running Local Servers To run a local server and connect to it you must pass the ip of the local server to graphwar