diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..42abd15 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.7 +RUN apk add --no-cache maven openjdk8 +COPY /. /app/ +WORKDIR /app +RUN mvn package \ + && cp Server/src/main/resources/config.properties /app/ +CMD ["java", "-jar", "/app/target/server-1.2a.jar"] diff --git a/README.md b/README.md index 5e11d6b..d15d56d 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,11 @@ In its current state, players can walk around the game universe and collect Biom ![screenshot from 2017-11-12 13-01-43](https://user-images.githubusercontent.com/7120851/32701793-e5d07e98-c7a9-11e7-9931-f8db7b287994.png) -Wiki: [GitHub](https://github.com/simon987/Much-Assembly-Required/wiki) +Wiki: [GitHub](https://github.com/simon987/Much-Assembly-Required/wiki) Chat: [Slack](https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLTkyOTIwOTA5OGY4MDVlMGI4NzM5YzlhMWJiMGY1OWE2NjUxODQ1NWQ1YTcxMTA1NGZkYzNjYzMyM2E1ODdmNzg) -# Deploying the server (Ubuntu or other Debian derivative) + +# Deploying the server Note: You can find the frontend [here](https://github.com/simon987/Much-Assembly-Required) @@ -31,3 +32,22 @@ java -jar server-1.2a.jar ## Windows Coming eventually... + +## Docker +### Requirements + +1. [Docker Compose](https://docs.docker.com/compose/install/#install-compose) (and dependencies) + +### Installation + +Once Docker and Docker Compose are installed, you can build and start +this application by running the following command inside this +application's directory: + +`docker-compose up` + +This will start MySQL and then build and run this application. It will +be available via http://localhost. + +Note that there is currently no frontend web application serving the +WebSocket feed served by the `Server` application! diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..08fb8c2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: "2.1" +services: + server: + build: + context: . + command: sh -c "sed -i -e 's#localhost#db#' config.properties && /usr/bin/java -jar /app/target/server-1.2a.jar" + depends_on: + db: + condition: service_healthy + ports: + - "8887:8887" + db: + image: mysql + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-umar", "-pmar"] + environment: + MYSQL_DATABASE: mar + MYSQL_PASSWORD: mar + MYSQL_RANDOM_ROOT_PASSWORD: "yes" + MYSQL_ROOT_PASSWORD: something-secret + MYSQL_USER: mar