Skip to content

Commit

Permalink
Fixes #373 - Add Dockerfile for Azure Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem committed Mar 23, 2024
1 parent de05549 commit aa80774
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 9 deletions.
14 changes: 5 additions & 9 deletions azure-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<release>${java.version}</release>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand All @@ -93,7 +92,6 @@
</systemPropertyVariables>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -102,16 +100,15 @@
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!--
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<configuration>
<images>
<image>
<alias>ocelot-azure-keyvault</alias>
<name>ghcr.io/manorrock/ocelot-azure-appconfig:%l</name>
<alias>ocelot-azure-storage</alias>
<name>ghcr.io/manorrock/ocelot-azure-storage:%l</name>
<build>
<buildx>
<platforms>
Expand All @@ -124,8 +121,8 @@
</build>
<run>
<ports>
<port>8101:8101</port>
<port>8201:8201</port>
<port>8103:8103</port>
<port>8203:8203</port>
</ports>
<volumes>
<bind>
Expand All @@ -134,7 +131,7 @@
</volumes>
<wait>
<http>
<url>http://localhost:8101/</url>
<url>http://localhost:8103/ping</url>
</http>
<time>20000</time>
</wait>
Expand Down Expand Up @@ -174,7 +171,6 @@
</execution>
</executions>
</plugin>
-->
</plugins>
</build>
</project>
8 changes: 8 additions & 0 deletions azure-storage/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/piranhacloud/webprofile:24.3.0
ADD target/ROOT.war /home/piranha
ADD src/main/docker/startup.sh /home/piranha
WORKDIR /home/piranha
USER piranha
RUN mkdir certs && \
keytool -genkey -alias self-signed -keyalg RSA -keystore certs/keystore -keysize 4096 -storepass password -dname "CN=localhost"
CMD ["sh", "./startup.sh"]
6 changes: 6 additions & 0 deletions azure-storage/src/main/docker/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

#
# Run the application
#
java -jar piranha-dist-webprofile.jar --war-file ROOT.war --http-port 8103 --https-port 8203 --https-keystore-file certs/keystore --https-keystore-password password
34 changes: 34 additions & 0 deletions azure-storage/src/main/java/storage/PingResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package storage;

import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;

/**
* Ping resource.
*
* @author Manfred Riem (mriem@manorrock.com)
*/
@Path("ping")
@Singleton
public class PingResource {

/**
* Constructor.
*/
public PingResource() {
}

/**
* Ping.
*
* @return "OK"
*/
@Path(value = "")
@GET
@Produces(value = "text/plain")
public String ping() {
return "OK";
}
}
13 changes: 13 additions & 0 deletions azure-storage/src/main/java/storage/StorageApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package storage;

import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

/**
* The Azure Storage application.
*
* @author Manfred Riem (mriem@manorrock.com)
*/
@ApplicationPath("")
public class StorageApplication extends Application {
}
7 changes: 7 additions & 0 deletions azure-storage/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
bean-discovery-mode="all">
</beans>
Binary file added azure-storage/src/test/certs/keystore
Binary file not shown.

0 comments on commit aa80774

Please sign in to comment.