docker support
This commit is contained in:
Родитель
afefef9fa7
Коммит
01ef005517
|
@ -29,5 +29,5 @@
|
|||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/jr/jackson-jr-objects/2.10.1/jackson-jr-objects-2.10.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.10.1/jackson-core-2.10.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-simple/1.7.29/slf4j-simple-1.7.29.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="EXTJAR" id="C:\dogfood\cartpole-java\lib\bonsai-sdk-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/microsoft/bonsai/bonsai-sdk/1.0/bonsai-sdk-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
</factorypath>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Distribution / packaging
|
||||
target/
|
||||
lib/
|
||||
docker/lib/
|
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>bonsai-sdk3</name>
|
||||
<name>microsoft.bonsai.samples</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
"name": "Debug (Launch) - Current File",
|
||||
"request": "launch",
|
||||
"mainClass": "${file}"
|
||||
// ,"args":"predict"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Launch)-App<bonsai-sdk3>",
|
||||
"request": "launch",
|
||||
"mainClass": "microsoft.bonsai.simulatorapi.App",
|
||||
"projectName": "bonsai-sdk3"
|
||||
|
||||
"projectName": "microsoft.bonsai.samples"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"java.configuration.updateBuildConfiguration": "interactive",
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.dependency.syncWithFolderExplorer": true,
|
||||
"java.dependency.packagePresentation": "hierarchical"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>bonsai-sdk3</name>
|
||||
<name>microsoft.bonsai.samples</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
@echo off
|
||||
if [%1]==[] goto usage
|
||||
if [%2]==[] goto usage
|
||||
|
||||
|
||||
SET image_name=%1
|
||||
SET container_registry=%2
|
||||
|
||||
ECHO Building image %image_name%
|
||||
|
||||
copy ..\target\microsoft.bonsai.samples.cartpole-1.0-jar-with-dependencies.jar lib
|
||||
|
||||
ECHO Building image %image_name%
|
||||
|
||||
docker build -t %image_name% .
|
||||
|
||||
ECHO Logging in to %container_registry%
|
||||
|
||||
cmd /c az acr login --name %container_registry%
|
||||
|
||||
ECHO Tagging %image_name% and pushing to %container_registry%.azurecr.io/%image_name%:latest
|
||||
|
||||
docker tag %image_name% %container_registry%.azurecr.io/%image_name%:latest
|
||||
docker push %container_registry%.azurecr.io/%image_name%:latest
|
||||
|
||||
ECHO Complete
|
||||
|
||||
:usage
|
||||
@echo Usage: %0 ^<docker_image_name^> ^<container_registry_name^>
|
||||
exit /B 1
|
|
@ -0,0 +1,14 @@
|
|||
version: '3.5'
|
||||
|
||||
services:
|
||||
sim:
|
||||
image: bonsai-cartpole-java
|
||||
environment:
|
||||
- SIM_WORKSPACE=998edb0d-525c-4858-9a80-dce2153e0ed0
|
||||
- SIM_ACCESS_KEY=YzMxYjYyMzA4N2YxNDE0NWJiNDFkNmNiMTUwZTQzYzc6OTBhZWNjY2ItY2ZjYy00YzViLTlmNTItZmFmOTRiNDA0Yjk3
|
||||
- SIM_API_HOST=https://api.bons.ai
|
||||
tty: true
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
FROM openjdk:11-jdk
|
||||
|
||||
COPY lib/microsoft.bonsai.samples.cartpole-1.0-jar-with-dependencies.jar /app/microsoft.bonsai.samples.cartpole-1.0-jar-with-dependencies.jar
|
||||
|
||||
CMD ["java","-jar","/app/microsoft.bonsai.samples.cartpole-1.0-jar-with-dependencies.jar"]
|
Двоичный файл не отображается.
43
pom.xml
43
pom.xml
|
@ -2,10 +2,10 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>microsoft.bonsai.samples</groupId>
|
||||
<artifactId>microsoft.bonsai.samples</artifactId>
|
||||
<artifactId>microsoft.bonsai.samples.cartpole</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0</version>
|
||||
<name>microsoft.bonsai.samples</name>
|
||||
<name>microsoft.bonsai.samples.cartpole</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -43,16 +43,43 @@
|
|||
|
||||
<!-- bonsai reference -->
|
||||
<dependency>
|
||||
<groupId>microsoft.bonsai.simulatorapi</groupId>
|
||||
<artifactId>bonsai-sdk</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/lib/bonsai-sdk-1.0.jar</systemPath>
|
||||
</dependency>
|
||||
<groupId>microsoft.bonsai</groupId>
|
||||
<artifactId>bonsai-sdk</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>microsoft.bonsai.samples.cartpole.App</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -5,7 +5,7 @@ package microsoft.bonsai.samples.cartpole;
|
|||
*/
|
||||
public class Action
|
||||
{
|
||||
// there is a value called 'command' in the action in inkling
|
||||
// there is a value called 'command' in the action type in inkling
|
||||
public double command = 0;
|
||||
|
||||
}
|
||||
|
|
|
@ -16,19 +16,6 @@ public class Model {
|
|||
static double TRACK_WIDTH = 1.0; // m
|
||||
static double FORCE_NOISE = 0.02; // % of FORCE_MAG
|
||||
|
||||
//static double THETA_LIMIT = (12 * 2 * Math.PI) / 360; // 12deg in radians
|
||||
|
||||
double x = 0; // cart position (m)
|
||||
double x_dot = 0; // cart velocity (m/s)
|
||||
//double theta = 0; // cart angle (rad)
|
||||
//double theta_dot = 0; // cart angular velocity (rad/s)
|
||||
double x_target = 0; // target pole position (m)
|
||||
double x_limit = TRACK_WIDTH / 2; // full track
|
||||
double x_delta = 0; // distance between target and pole position (m)
|
||||
double x_pole = 0; // pole position (m)
|
||||
double y_pole = 0; // height of pol COG (m)
|
||||
double x_pole_dot = 0; // pole velocity (m/s)
|
||||
|
||||
double cart_position;
|
||||
double cart_velocity;
|
||||
double pole_angle;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package microsoft.bonsai.samples.cartpole;
|
||||
|
||||
/**
|
||||
* The State class maps to the state values in inkling.
|
||||
*/
|
||||
public class State {
|
||||
|
||||
|
||||
public double cart_position;
|
||||
public double cart_velocity;
|
||||
|
|
Двоичные данные
target/bonsai-sdk3-1.0-SNAPSHOT.jar
Двоичные данные
target/bonsai-sdk3-1.0-SNAPSHOT.jar
Двоичный файл не отображается.
|
@ -1,5 +1,4 @@
|
|||
#Generated by Maven
|
||||
#Fri Jul 10 05:21:32 GMT 2020
|
||||
#Created by Apache Maven 3.6.3
|
||||
groupId=microsoft.bonsai.samples
|
||||
artifactId=microsoft.bonsai.samples
|
||||
artifactId=microsoft.bonsai.samples.cartpole
|
||||
version=1.0
|
||||
|
|
Загрузка…
Ссылка в новой задаче