-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0de82b3
commit 6b08e6d
Showing
7 changed files
with
136 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.acme</groupId> | ||
<artifactId>minecrafter-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>minecrafter-deployment</artifactId> | ||
<name>Minecrafter - Deployment</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-rest-client-reactive-jackson-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.acme</groupId> | ||
<artifactId>minecrafter</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.acme</groupId> | ||
<artifactId>minecrafter-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>minecrafter-deployment</artifactId> | ||
<name>Minecrafter - Deployment</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-rest-client-reactive-jackson-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-devservices-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.acme</groupId> | ||
<artifactId>minecrafter</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
43 changes: 43 additions & 0 deletions
43
extension/deployment/src/main/java/org/acme/minecrafter/deployment/MinecraftContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.acme.minecrafter.deployment; | ||
|
||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.Network; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class MinecraftContainer extends GenericContainer<MinecraftContainer> { | ||
private static final int MINECRAFT_PORT = 25565; | ||
static final int OBSERVABILITY_PORT = 8081; | ||
|
||
public MinecraftContainer(DockerImageName image) { | ||
super(image); | ||
|
||
List<String> portBindings = new ArrayList<>(); | ||
portBindings.add("25565:25565"); // Make life easy for the minecraft client | ||
setPortBindings(portBindings); | ||
//withReuse(true); | ||
|
||
// withExposedPorts(MINECRAFT_PORT); | ||
// This is a bit of a cheat, since at this point the client isn't ready, but otherwise it's too slow | ||
waitingFor(Wait.forLogMessage(".*" + "Preparing" + ".*", 1)); | ||
} | ||
|
||
|
||
@Override | ||
protected void configure() { | ||
withNetwork(Network.SHARED); | ||
addExposedPorts(OBSERVABILITY_PORT); | ||
addExposedPorts(MINECRAFT_PORT); | ||
} | ||
|
||
public Integer getApiPort() { | ||
return this.getMappedPort(OBSERVABILITY_PORT); | ||
} | ||
|
||
public Integer getGamePort() { | ||
return this.getMappedPort(MINECRAFT_PORT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters