Skip to content

Commit

Permalink
Updates docker image creation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Oct 4, 2024
1 parent 8589245 commit 4ce6377
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 50 deletions.
4 changes: 2 additions & 2 deletions databridge.component/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ FROM openjdk:11-slim-bullseye
RUN apt update && apt install -y wget && apt clean

# Copy built jar to image using the jar name specified in the pom.xml (JAR_FILE)
ARG JAR_FILE
ARG JAR_FILE=target/*.jar

COPY target/${JAR_FILE} /usr/share/databridgeExecutable.jar
COPY ${JAR_FILE} /usr/share/databridgeExecutable.jar
COPY target/lib /usr/share/lib

# Expose this port for health check
Expand Down
72 changes: 25 additions & 47 deletions databridge.component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<basyx.databridge.executable>org.eclipse.digitaltwin.basyx.databridge.component.DataBridgeExecutable</basyx.databridge.executable>
<docker.image.name>databridge</docker.image.name>
</properties>

<!-- Define additional plugins that are not included by default -->
Expand Down Expand Up @@ -58,13 +59,6 @@
<excludes>
<exclude>**/logback.xml</exclude>
</excludes>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</configuration>
</plugin>
</plugins>
Expand All @@ -87,106 +81,106 @@
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-paho</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-aas</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-jsonata</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-activemq</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-hono</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-httppolling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-kafka</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-opcua</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-sql</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-timer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-jsonjackson</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.camel-plc4x</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.examples.plc4x-jsonata-aas</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.examples.aas-jsonata-mqtt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.examples.sql-jsonata-aas</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.examples.aas-jsonata-http</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>databridge.examples.httpserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -294,7 +288,7 @@
<profile>
<!-- "Docker" profile - do not build & install docker images by default
Run "mvn install -Pdocker" in order to include docker -->
<id>docker</id>
<id>docker-push</id>
<build>
<plugins>
<!-- Read maven properties from file -->
Expand Down Expand Up @@ -340,28 +334,12 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.43.2</version>
<configuration>
<images>
<image>
<name>${BASYX_IMAGE_NAME}:${BASYX_IMAGE_TAG}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<args>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</args>
</build>
</image>
</images>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<id>docker:build</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
<id>build-docker</id>
</execution>
<execution>
<id>push-docker</id>
</execution>
</executions>
</plugin>
Expand All @@ -376,8 +354,8 @@
<detachedMode>true</detachedMode>
<envFile>${project.basedir}/src/test/resources/.env</envFile>
<envVars>
<BASYX_IMAGE_TAG>${BASYX_IMAGE_TAG}</BASYX_IMAGE_TAG>
<BASYX_IMAGE_NAME>${BASYX_IMAGE_NAME}</BASYX_IMAGE_NAME>
<BASYX_IMAGE_TAG>${docker.image.tag}</BASYX_IMAGE_TAG>
<BASYX_IMAGE_NAME>${docker.namespace}/${docker.image.name}</BASYX_IMAGE_NAME>
<VOLUME_MAPPING>${project.basedir}/src/test/resources/mqtt</VOLUME_MAPPING>
</envVars>
</configuration>
Expand Down
110 changes: 109 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>

<developers>
<developer>
<organization>Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.</organization>
Expand All @@ -41,11 +42,17 @@
<email>[email protected]</email>
</developer>
</developers>

<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<revision>0.0.1-SNAPSHOT</revision>
<revision>1.0.0-SNAPSHOT</revision>
<docker.provenance />
<docker.namespace>eclipsebasyx</docker.namespace>
<docker.image.name>NOT_DEFINED_IN_MODULE</docker.image.name>
<docker.image.tag>${revision}</docker.image.tag>
<docker.target.platforms>linux/amd64, linux/arm64/v8</docker.target.platforms>
<camel.version>3.21.0</camel.version>
</properties>

Expand Down Expand Up @@ -76,6 +83,70 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.45.1</version>
<configuration>
<images>
<image>
<name>
${docker.namespace}/${docker.image.name}:${docker.image.tag}</name>
<registry>docker.io</registry>
<build>
<contextDir>${project.basedir}</contextDir>
<args>
</args>
<labels>
<maven.version>${project.version}</maven.version>
<maven.build.timestamp>
${maven.build.timestamp}</maven.build.timestamp>
</labels>
<noCache>true</noCache>
<buildx>
<platforms>
${docker.target.platforms}
</platforms>
</buildx>
</build>
</image>
</images>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<id>build-docker</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-docker</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
<configuration>
<images>
<image>
<build>
<buildx>
<platforms>
${docker.target.platforms}</platforms>
</buildx>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencyManagement>
Expand All @@ -89,4 +160,41 @@
</dependency>
</dependencies>
</dependencyManagement>

<profiles>
<profile>
<id>docker-push</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>push-docker</id>
<phase>package</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.dash</groupId>
<artifactId>license-tool-plugin</artifactId>
<version>1.1.1-SNAPSHOT</version>
<executions>
<execution>
<id>license-check</id>
<goals>
<goal>license-check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 4ce6377

Please sign in to comment.