dockerize reverse

master
io42630 1 year ago
parent a5b3474054
commit f4a595f370

@ -0,0 +1,4 @@
FROM eclipse-temurin:17-alpine
COPY /target/reverse-0.1-jar-with-dependencies.jar /usr/local/lib/reverse-0.1-jar-with-dependencies.jar
EXPOSE 8090
ENTRYPOINT ["java","-jar","/usr/local/lib/reverse-0.1-jar-with-dependencies.jar"]

@ -13,4 +13,8 @@
* Runnable
* Journey fo a `Ride` through the App.
* `Tools`
* Performs the actual request.
* Performs the actual request.
### Build
* maven clean package
* Dockerfile -> build

@ -1,11 +0,0 @@
#!/bin/bash
version="0.1"
artifactId="reverse"
file="target/${artifactId}-${version}.jar"
groupId="com.olexyn.misp.reverse"
mvn package
mvn install:install-file -Dfile=${file} -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar -DgeneratePom=true

@ -3,28 +3,31 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.olexyn</groupId>
<artifactId>zeeroot</artifactId>
<version>17.0.1</version>
</parent>
<groupId>com.olexyn.misp.reverse</groupId>
<artifactId>reverse</artifactId>
<version>0.1</version>
<name>reverse</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.olexyn</groupId>
<artifactId>zeebom</artifactId>
<version>1.1.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.olexyn.misp.helper</groupId>
<artifactId>helper</artifactId>
@ -34,53 +37,40 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.olexyn.misp.reverse.Reverse</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -7,6 +7,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Tools {

@ -2,12 +2,15 @@ package com.olexyn.misp.reverse.runnable;
import com.olexyn.misp.reverse.Reverse;
import com.olexyn.misp.reverse.Tools;
import lombok.Getter;
import org.json.JSONObject;
public class CheckSuppyR implements Runnable {
@Getter
private int available;
public int CHECK_SUPPLY_INTERVAL = 100;
public int CHECK_SUPPLY_INTERVAL_MILLI = 100;
private Reverse reverse;
@ -28,7 +31,7 @@ public class CheckSuppyR implements Runnable {
available = resultObj.getInt("available");
Thread.sleep(CHECK_SUPPLY_INTERVAL);
Thread.sleep(CHECK_SUPPLY_INTERVAL_MILLI);
} catch (Exception ignored) { }
}
@ -36,6 +39,4 @@ public class CheckSuppyR implements Runnable {
}
public int getAvailable() { return available; }
}

@ -9,8 +9,8 @@ public class JourneyGeneratorR implements Runnable {
public int CHECK_DEPLETION_INTERVAL = 500;
public int START_NEW_JOURNEY_INTERVAL = 100;
private Reverse reverse;
private CheckSuppyR checkSuppyR;
private final Reverse reverse;
private final CheckSuppyR checkSuppyR;
public JourneyGeneratorR(Reverse reverse , CheckSuppyR checkSuppyR) {
this.reverse = reverse;

@ -18,10 +18,10 @@ public class JourneyR implements Runnable {
@Override
public void run() {
try {
Ride _ride = sendPostRide();
_ride = sendGetRequest(_ride);
sendPostRideRequestData(_ride);
} catch (Exception ignored) { }
var ride = sendPostRide();
ride = sendGetRequest(ride);
sendPostRideRequestData(ride);
} catch (Exception ignored) { /* ignored */ }
}

Loading…
Cancel
Save