Skip to content

Commit

Permalink
Fixes #313 - Create Docker image (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Jul 19, 2024
1 parent 255915f commit e0e0146
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 48 deletions.
97 changes: 97 additions & 0 deletions docker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.manorrock.sphynx</groupId>
<artifactId>project</artifactId>
<version>24.5.0-SNAPSHOT</version>
</parent>
<artifactId>sphynx-docker</artifactId>
<name>Manorrock Sphynx - Docker</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.manorrock.sphynx</groupId>
<artifactId>sphynx-rest</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.manorrock.sphynx</groupId>
<artifactId>sphynx-rest</artifactId>
<version>${project.version}</version>
<type>war</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/wars</outputDirectory>
<destFileName>rest.war</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<configuration>
<createContainers>true</createContainers>
<images>
<image>
<alias>sphynx</alias>
<name>ghcr.io/manorrock/sphynx:%l</name>
<build>
<buildx>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
<platform>linux/arm</platform>
</platforms>
</buildx>
<contextDir>${basedir}</contextDir>
<dockerFile>src/main/docker/Dockerfile</dockerFile>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
6 changes: 6 additions & 0 deletions docker/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/piranhacloud/webprofile:24.7.0
COPY target/wars/rest.war ROOT.war
USER root
RUN chown -R piranha:piranha /home/piranha
USER piranha
CMD ["java", "-jar", "piranha-dist-webprofile.jar", "--war-file", "ROOT.war", "--verbose"]
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<docker-maven-plugin.version>0.42.1</docker-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
<maven-dependency-plugin.version>3.7.1</maven-dependency-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
Expand Down Expand Up @@ -202,5 +202,6 @@
<module>desktop</module>
<module>rest</module>
<module>shared</module>
<module>docker</module>
</modules>
</project>
43 changes: 0 additions & 43 deletions rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,47 +116,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<configuration>
<createContainers>true</createContainers>
<images>
<image>
<alias>sphynx</alias>
<name>ghcr.io/manorrock/sphynx:%l</name>
<build>
<buildx>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
<platform>linux/arm</platform>
</platforms>
</buildx>
<contextDir>${basedir}</contextDir>
<dockerFile>src/main/docker/Dockerfile</dockerFile>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
4 changes: 0 additions & 4 deletions rest/src/main/docker/Dockerfile

This file was deleted.

0 comments on commit e0e0146

Please sign in to comment.