From b56ca865756c89f77a342a87f5f98e889ca44761 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Sat, 23 Mar 2024 09:20:53 -0500 Subject: [PATCH] Fixes #373 - Add Dockerfile for Azure Storage (#374) --- azure-storage/pom.xml | 14 +++----- azure-storage/src/main/docker/Dockerfile | 8 +++++ azure-storage/src/main/docker/startup.sh | 6 ++++ .../src/main/java/storage/PingResource.java | 34 ++++++++++++++++++ .../main/java/storage/StorageApplication.java | 13 +++++++ .../src/main/webapp/WEB-INF/beans.xml | 7 ++++ azure-storage/src/test/certs/keystore | Bin 0 -> 4242 bytes 7 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 azure-storage/src/main/docker/Dockerfile create mode 100644 azure-storage/src/main/docker/startup.sh create mode 100644 azure-storage/src/main/java/storage/PingResource.java create mode 100644 azure-storage/src/main/java/storage/StorageApplication.java create mode 100644 azure-storage/src/main/webapp/WEB-INF/beans.xml create mode 100644 azure-storage/src/test/certs/keystore diff --git a/azure-storage/pom.xml b/azure-storage/pom.xml index 3672fef..c30bc49 100644 --- a/azure-storage/pom.xml +++ b/azure-storage/pom.xml @@ -70,7 +70,6 @@ ${java.version} - org.apache.maven.plugins maven-war-plugin @@ -102,7 +100,6 @@ false - diff --git a/azure-storage/src/main/docker/Dockerfile b/azure-storage/src/main/docker/Dockerfile new file mode 100644 index 0000000..3b4314b --- /dev/null +++ b/azure-storage/src/main/docker/Dockerfile @@ -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"] diff --git a/azure-storage/src/main/docker/startup.sh b/azure-storage/src/main/docker/startup.sh new file mode 100644 index 0000000..56cd4da --- /dev/null +++ b/azure-storage/src/main/docker/startup.sh @@ -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 diff --git a/azure-storage/src/main/java/storage/PingResource.java b/azure-storage/src/main/java/storage/PingResource.java new file mode 100644 index 0000000..5beb9d8 --- /dev/null +++ b/azure-storage/src/main/java/storage/PingResource.java @@ -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"; + } +} diff --git a/azure-storage/src/main/java/storage/StorageApplication.java b/azure-storage/src/main/java/storage/StorageApplication.java new file mode 100644 index 0000000..4967858 --- /dev/null +++ b/azure-storage/src/main/java/storage/StorageApplication.java @@ -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 { +} diff --git a/azure-storage/src/main/webapp/WEB-INF/beans.xml b/azure-storage/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..a73f48d --- /dev/null +++ b/azure-storage/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,7 @@ + + + + diff --git a/azure-storage/src/test/certs/keystore b/azure-storage/src/test/certs/keystore new file mode 100644 index 0000000000000000000000000000000000000000..5342ef99758ede47d78ada2818187f8db5308b29 GIT binary patch literal 4242 zcma)iQt^g_;YnXf(918#hWC!E2AP3_z{%zBOgVFytLjQ}< z|04ANAWBq>|JlMs2Owq#qjiFV(OSV)|A?Vrf%U-u3ZP(u*^mi5T;lIB0;&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