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 * Runnable
* Journey fo a `Ride` through the App. * Journey fo a `Ride` through the App.
* `Tools` * `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" <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"> 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> <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> <groupId>com.olexyn.misp.reverse</groupId>
<artifactId>reverse</artifactId> <artifactId>reverse</artifactId>
<version>0.1</version> <version>0.1</version>
<name>reverse</name> <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> <dependencyManagement>
<maven.compiler.source>11</maven.compiler.source> <dependencies>
<maven.compiler.target>11</maven.compiler.target> <dependency>
</properties> <groupId>com.olexyn</groupId>
<artifactId>zeebom</artifactId>
<version>1.1.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.olexyn.misp.helper</groupId> <groupId>com.olexyn.misp.helper</groupId>
<artifactId>helper</artifactId> <artifactId>helper</artifactId>
@ -34,53 +37,40 @@
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>
<version>20190722</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins>
<plugins> <plugin>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <artifactId>maven-assembly-plugin</artifactId>
<plugin> <configuration>
<artifactId>maven-clean-plugin</artifactId> <archive>
<version>3.1.0</version> <manifest>
</plugin> <mainClass>com.olexyn.misp.reverse.Reverse</mainClass>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> </manifest>
<plugin> </archive>
<artifactId>maven-resources-plugin</artifactId> <descriptorRefs>
<version>3.0.2</version> <descriptorRef>jar-with-dependencies</descriptorRef>
</plugin> </descriptorRefs>
<plugin> </configuration>
<artifactId>maven-compiler-plugin</artifactId> <executions>
<version>3.8.0</version> <execution>
</plugin> <id>make-assembly</id> <!-- this is used for inheritance merges -->
<plugin> <phase>package</phase> <!-- bind to the packaging phase -->
<artifactId>maven-surefire-plugin</artifactId> <goals>
<version>2.22.1</version> <goal>single</goal>
</plugin> </goals>
<plugin> </execution>
<artifactId>maven-jar-plugin</artifactId> </executions>
<version>3.0.2</version> </plugin>
</plugin> </plugins>
<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>
</build> </build>
</project> </project>

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

@ -2,12 +2,15 @@ package com.olexyn.misp.reverse.runnable;
import com.olexyn.misp.reverse.Reverse; import com.olexyn.misp.reverse.Reverse;
import com.olexyn.misp.reverse.Tools; import com.olexyn.misp.reverse.Tools;
import lombok.Getter;
import org.json.JSONObject; import org.json.JSONObject;
public class CheckSuppyR implements Runnable { public class CheckSuppyR implements Runnable {
@Getter
private int available; private int available;
public int CHECK_SUPPLY_INTERVAL = 100;
public int CHECK_SUPPLY_INTERVAL_MILLI = 100;
private Reverse reverse; private Reverse reverse;
@ -28,7 +31,7 @@ public class CheckSuppyR implements Runnable {
available = resultObj.getInt("available"); available = resultObj.getInt("available");
Thread.sleep(CHECK_SUPPLY_INTERVAL); Thread.sleep(CHECK_SUPPLY_INTERVAL_MILLI);
} catch (Exception ignored) { } } 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 CHECK_DEPLETION_INTERVAL = 500;
public int START_NEW_JOURNEY_INTERVAL = 100; public int START_NEW_JOURNEY_INTERVAL = 100;
private Reverse reverse; private final Reverse reverse;
private CheckSuppyR checkSuppyR; private final CheckSuppyR checkSuppyR;
public JourneyGeneratorR(Reverse reverse , CheckSuppyR checkSuppyR) { public JourneyGeneratorR(Reverse reverse , CheckSuppyR checkSuppyR) {
this.reverse = reverse; this.reverse = reverse;

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

Loading…
Cancel
Save