Merge pull request #75 from sgerrand/dockerize

Add a Docker image definition for the application and a Docker Compose configuration file
This commit is contained in:
Simon Fortier 2017-12-31 09:56:07 -05:00 committed by GitHub
commit b2474494cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 2 deletions

7
Dockerfile Normal file
View File

@ -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"]

View File

@ -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!

21
docker-compose.yml Normal file
View File

@ -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