From de3a9397d6b29c08601172858d1bac15efecab69 Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Wed, 24 Jul 2019 21:33:45 +0200 Subject: [PATCH] Start on docker image --- .env | 2 + .gitignore | 3 ++ Dockerfile | 8 ++++ docker-compose.yaml | 31 +++++++++++++++ pom.xml | 93 ++++++++++++++++++++++++++++++++++++--------- 5 files changed, 118 insertions(+), 19 deletions(-) create mode 100644 .env create mode 100644 docker-compose.yaml diff --git a/.env b/.env new file mode 100644 index 0000000..097104c --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +API_ROOT=ewngu43gbipbowboi +WORKING_DIR=/Users/tobias/Documents/Programmieren/Projects/PlayWall/PlayWallServer \ No newline at end of file diff --git a/.gitignore b/.gitignore index c7c1032..7ef55bd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ /settings.properties /target /deploy +/build/ +/deploy_docker/ +/storage/ diff --git a/Dockerfile b/Dockerfile index e69de29..1c60230 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM openjdk:8 + +USER root + +COPY build/1.0-SNAPSHOT/playwall-server.jar /root/playwall-server.jar +WORKDIR /root + +CMD ["java", "-jar", "playwall-server.jar"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..9448130 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,31 @@ +version: '3.3' +services: + mysql: + image: mysql:8 + restart: always + environment: + MYSQL_ROOT_PASSWORD: ${API_ROOT} + MYSQL_DATABASE: api + MYSQL_ROOT_HOST: '%' + volumes: + - "${WORKING_DIR}/storage/mysql:/var/lib/mysql" + networks: + - netMySQL + ports: + - "3306:3306" + playwall: + image: jtobisan/playwall-server:latest + restart: always + volumes: + - "${WORKING_DIR}/deploy_docker:/root/deploy" + expose: + - "8090" + ports: + - "8080:8080" + networks: + - netMySQL + depends_on: + - mysql +networks: + netMySQL: + driver: bridge diff --git a/pom.xml b/pom.xml index f09eca6..ebf1d79 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,14 @@ <version>1.0-SNAPSHOT</version> <properties> - <java-version>1.8</java-version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <project.main>de.tobias.playpad.server.PlayPadServer</project.main> + <java.version>1.8</java.version> + + <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> + <scala-maven-plugin.version>3.4.4</scala-maven-plugin.version> + <maven-jar-plugin.version>2.3.1</maven-jar-plugin.version> <scala-library.version>[2.13.0,)</scala-library.version> @@ -86,22 +92,50 @@ </dependencies> <build> + <!-- <finalName>PlayWallServer</finalName>--> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> + <version>${maven-compiler-plugin.version}</version> <configuration> - <source>${java-version}</source> - <target>${java-version}</target> + <source>${java.version}</source> + <target>${java.version}</target> </configuration> </plugin> + + <plugin> + <groupId>net.alchim31.maven</groupId> + <artifactId>scala-maven-plugin</artifactId> + <version>${scala-maven-plugin.version}</version> + <executions> + <execution> + <id>scala-compile-first</id> + <phase>process-resources</phase> + <goals> + <goal>add-source</goal> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>scala-test-compile</id> + <phase>process-test-resources</phase> + <goals> + <goal>testCompile</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> + <outputDirectory>build/${project.version}</outputDirectory> + <finalName>${project.artifactId}</finalName> + <appendAssemblyId>false</appendAssemblyId> <archive> <manifest> - <mainClass>de.tobias.playpad.server.PlayPadServer</mainClass> + <mainClass>${project.main}</mainClass> </manifest> </archive> <descriptorRefs> @@ -118,22 +152,22 @@ </execution> </executions> </plugin> - <plugin> - <groupId>org.scala-tools</groupId> - <artifactId>maven-scala-plugin</artifactId> - <version>2.15.2</version> - <executions> - <execution> - <goals> - <goal>compile</goal> - <goal>testCompile</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> </build> + <distributionManagement> + <repository> + <id>release</id> + <name>TheCodeLabs-releases</name> + <url>https://maven.thecodelabs.de/artifactory/TheCodeLabs-release</url> + </repository> + <snapshotRepository> + <id>snapshots</id> + <name>TheCodeLabs-snapshots</name> + <url>https://maven.thecodelabs.de/artifactory/TheCodeLabs-snapshots</url> + </snapshotRepository> + </distributionManagement> + <pluginRepositories> <pluginRepository> <id>scala</id> @@ -146,8 +180,29 @@ <enabled>false</enabled> </snapshots> </pluginRepository> + <pluginRepository> + <id>release</id> + <url>https://maven.thecodelabs.de/artifactory/TheCodeLabs-plugins-release</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + <pluginRepository> + <id>snapshots</id> + <url>https://maven.thecodelabs.de/artifactory/TheCodeLabs-plugins-snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> </pluginRepositories> + <repositories> <repository> <id>scala</id> @@ -163,7 +218,7 @@ <repository> <id>release</id> - <url>https://maven.thecodelabs.de/artifactory/TheCodeLabs-release</url> + <url>https://maven.thecodelabs.de/artifactory/Releases</url> <releases> <enabled>true</enabled> </releases> -- GitLab