From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

Added Ratpack app example

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/ratpack-example/.gitignore b/ratpack-example/.gitignore
--- a/ratpack-example/.gitignore
+++ b/ratpack-example/.gitignore
@@ -0,0 +1 @@
+usr.manifest
diff --git a/ratpack-example/Makefile b/ratpack-example/Makefile
--- a/ratpack-example/Makefile
+++ b/ratpack-example/Makefile
@@ -0,0 +1,20 @@
+src = $(shell readlink -f ../..)
+app-dir = $(src)/apps/ratpack-example
+
+all: module
+module: ratpack-example
+
+module: $(app-dir)/upstream/tutorials/.git
+ cd $(app-dir)/upstream/tutorials/ratpack && mvn -Dgib.enabled=false package + mkdir -p $(app-dir)/ROOTFS && cd $(app-dir)/ROOTFS && jar xf ../upstream/tutorials/ratpack/target/ratpack.jar
+       echo "/ratpack-app/**: $(app-dir)/ROOTFS/**" > $(app-dir)/usr.manifest
+
+.PHONY: ratpack-example
+
+$(app-dir)/upstream/tutorials/.git:
+       mkdir -p $(app-dir)/upstream
+ cd $(app-dir)/upstream && git clone --depth 1 https://github.com/eugenp/tutorials.git
+       patch $(app-dir)/upstream/tutorials/ratpack/pom.xml pom.patch
+
+clean:
+       cd $(app-dir) && rm -rf upstream ROOTFS usr.manifest
diff --git a/ratpack-example/README.md b/ratpack-example/README.md
--- a/ratpack-example/README.md
+++ b/ratpack-example/README.md
@@ -0,0 +1,13 @@
+# Ratpack on OSv
+
+Ratpack is a lean powerfull framework based on Netty
+intended to build http applications in Java.
+You can read more here https://ratpack.io/
+
+## Building
+Ratpack requires at least Java 8.
+
+Here is how you can build it
+```
+./scripts/build image=openjdk8-zulu-full,ratpack-example
+```
diff --git a/ratpack-example/module.py b/ratpack-example/module.py
--- a/ratpack-example/module.py
+++ b/ratpack-example/module.py
@@ -0,0 +1,5 @@
+from osv.modules import api
+
+api.require('java8')
+
+default = api.run('/java.so -cp /ratpack-app org.springframework.boot.loader.JarLauncher')
diff --git a/ratpack-example/pom.patch b/ratpack-example/pom.patch
--- a/ratpack-example/pom.patch
+++ b/ratpack-example/pom.patch
@@ -0,0 +1,27 @@
+--- pom.xml    2018-10-16 21:58:47.000000000 -0400
++++ pom.xml.patched    2018-10-16 22:01:01.000000000 -0400
+@@ -80,10 +80,24 @@
+         <resources>
+             <resource>
+                 <directory>src/main/resources</directory>
+             </resource>
+         </resources>
++       <plugins>
++         <plugin>
++           <groupId>org.springframework.boot</groupId>
++           <artifactId>spring-boot-maven-plugin</artifactId>
++           <version>2.0.5.RELEASE</version>
++           <executions>
++             <execution>
++               <goals>
++                 <goal>repackage</goal>
++               </goals>
++             </execution>
++           </executions>
++         </plugin>
++       </plugins>
+     </build>
+
+     <properties>
+         <maven.compiler.source>1.8</maven.compiler.source>
+         <maven.compiler.target>1.8</maven.compiler.target>

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to