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

@ -14,3 +14,7 @@
* 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>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>com.olexyn</groupId>
<artifactId>junit</artifactId> <artifactId>zeebom</artifactId>
<version>4.11</version> <version>1.1.1</version>
<scope>test</scope> <type>pom</type>
<scope>import</scope>
</dependency> </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<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>
<!-- 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> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.22.1</version> <configuration>
</plugin> <archive>
<plugin> <manifest>
<artifactId>maven-jar-plugin</artifactId> <mainClass>com.olexyn.misp.reverse.Reverse</mainClass>
<version>3.0.2</version> </manifest>
</plugin> </archive>
<plugin> <descriptorRefs>
<artifactId>maven-install-plugin</artifactId> <descriptorRef>jar-with-dependencies</descriptorRef>
<version>2.5.2</version> </descriptorRefs>
</plugin> </configuration>
<plugin> <executions>
<artifactId>maven-deploy-plugin</artifactId> <execution>
<version>2.8.2</version> <id>make-assembly</id> <!-- this is used for inheritance merges -->
</plugin> <phase>package</phase> <!-- bind to the packaging phase -->
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <goals>
<plugin> <goal>single</goal>
<artifactId>maven-site-plugin</artifactId> </goals>
<version>3.7.1</version> </execution>
</plugin> </executions>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin> </plugin>
</plugins> </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