small, multi-platform (amd64, arm64) images 81/96081/2
authorSimon Hrabos <simon.hrabos@tieto.com>
Fri, 20 Sep 2019 13:19:24 +0000 (15:19 +0200)
committerSimon Hrabos <simon.hrabos@tieto.com>
Tue, 24 Sep 2019 08:00:35 +0000 (10:00 +0200)
Modify fproxy, rproxy and tproxy-config docker container image due to arm64 compatibility

Issue-ID: INT-1174
Issue-ID: INT-1175
Issue-ID: INT-1176
Signed-off-by: Simon Hrabos <simon.hrabos@tieto.com>
Change-Id: Ibbf9e1d15bea9ebb1b82ff50c8671927c68be2ed

sidecar/fproxy/pom.xml
sidecar/fproxy/src/main/assembly/descriptor.xml [new file with mode: 0644]
sidecar/fproxy/src/main/docker/Dockerfile
sidecar/pom.xml
sidecar/rproxy/pom.xml
sidecar/rproxy/src/main/assembly/descriptor.xml [new file with mode: 0644]
sidecar/rproxy/src/main/docker/Dockerfile
sidecar/tproxy-config/pom.xml
sidecar/tproxy-config/src/main/assembly/descriptor.xml [new file with mode: 0644]
sidecar/tproxy-config/src/main/docker/Dockerfile

index 8875dd8..a84ee98 100644 (file)
                <version>2.1.14-SNAPSHOT</version>
        </parent>
 
+       <properties>
+                <fproxy.build.dir>${project.build.directory}/${project.artifactId}-build/</fproxy.build.dir>
+        </properties>
+
        <artifactId>fproxy</artifactId>
        <packaging>jar</packaging>
 
                                <configuration>
                                        <reuseForks>false</reuseForks>
                                        <forkCount>1</forkCount>
+                                       <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                                </configuration>
                        </plugin>
                        <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>3.0.2</version>
-                               <executions>
-                                       <execution>
-                                               <id>copy-docker-file</id>
-                                               <phase>package</phase>
-                                               <goals>
-                                                       <goal>copy-resources</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <outputDirectory>target</outputDirectory>
-                                                       <overwrite>true</overwrite>
-                                                       <resources>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/docker</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/bin/</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                       </resources>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
+                               <artifactId>maven-assembly-plugin</artifactId>
+                               <configuration>
+                                       <descriptors>
+                                               <descriptor>src/main/assembly/descriptor.xml</descriptor>
+                                       </descriptors>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>make-assembly</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>single</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
                        <plugin>
-                               <groupId>com.spotify</groupId>
-                               <artifactId>docker-maven-plugin</artifactId>
-                               <version>0.4.11</version>
-                               <configuration>
-                                       <verbose>true</verbose>
-                                       <serverId>docker-hub</serverId>
-                                       <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
-                                       <dockerDirectory>${docker.location}</dockerDirectory>
-                                       <imageTags>
-                                               <imageTag>latest</imageTag>
-                                       </imageTags>
-                                       <forceTags>true</forceTags>
-                               </configuration>
+                                       <groupId>io.fabric8</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>0.28.0</version>
+                               <configuration>
+                                       <verbose>true</verbose>
+                                       <apiVersion>${docker.apiVersion}</apiVersion>
+                                       <pullRegistry>${docker.pull.registry}</pullRegistry>
+                                       <pushRegistry>${docker.push.registry}</pushRegistry>
+                                       <serverId>docker-hub</serverId>
+                                       <dockerDirectory>${docker.location}</dockerDirectory>
+                                       <imageTags>
+                                               <imageTag>latest</imageTag>
+                                       </imageTags>
+                                       <forceTags>true</forceTags>
+                                       <images>
+                                               <image>
+                                                       <name>${docker.push.registry}/onap/${project.artifactId}</name>
+                                                       <build>
+                                                               <cleanup>try</cleanup>
+                                                                       <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
+                                                               <tags>
+                                                                       <tag>latest</tag>
+                                                               </tags>
+                                                                       <assembly>
+                                                                       <inline>
+                                                                               <fileSets>
+                                                                                       <fileSet>
+                                                                                               <directory>${fproxy.build.dir}</directory>
+                                                                                               <outputDirectory>/${project.artifactId}</outputDirectory>
+                                                                                       </fileSet>
+                                                                               </fileSets>
+                                                                       </inline>
+                                                               </assembly>
+                                                       </build>
+                                               </image>
+                                       </images>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>generate-images</id>
+                                               <phase>install</phase>
+                                               <!--unbind default goal for this phase-->
+                                       </execution>
+                                       <execution>
+                                               <id>push-images</id>
+                                               <phase>deploy</phase>
+                                               <goals>
+                                                       <goal>push</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
diff --git a/sidecar/fproxy/src/main/assembly/descriptor.xml b/sidecar/fproxy/src/main/assembly/descriptor.xml
new file mode 100644 (file)
index 0000000..eb645f2
--- /dev/null
@@ -0,0 +1,29 @@
+<assembly xmlns="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http_://www.__w3.org/2001/XMLSchema-instance"
+          xsi:SchemaLocation="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http_://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>build</id>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <formats>
+        <format>dir</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/bin</directory>
+            <outputDirectory>/bin</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.build.directory}</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>*.jar</include>
+            </includes>
+            <excludes>   
+            <exclude>Dockerfile</exclude>
+                <exclude>*.sh</exclude>
+            </excludes>
+        </fileSet>
+    </fileSets>
+</assembly>
index d91f0e3..4537e24 100644 (file)
@@ -1,35 +1,28 @@
-FROM ubuntu:14.04
+FROM openjdk:8-alpine
 
 ARG MICRO_HOME=/opt/app/fproxy
 ARG BIN_HOME=$MICRO_HOME/bin
 ARG JAR_FILE=fproxy-exec.jar
 
-RUN apt-get update
-
-# Install and setup java8
-RUN apt-get update && apt-get install -y software-properties-common
-## sudo -E is required to preserve the environment. If you remove that line, it will most like freeze at this step
-RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk
-
-RUN sudo dpkg --purge --force-depends ca-certificates-java
-RUN sudo apt-get install ca-certificates-java
+RUN apk update && \
+    apk add ca-certificates
 
 ## Setup JAVA_HOME, this is useful for docker commandline
-ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)
+ENV JAVA_HOME usr/lib/jvm/java-1.8-openjdk
 RUN export JAVA_HOME
 
 # Build up the deployment folder structure
 RUN mkdir -p $MICRO_HOME
-COPY ${JAR_FILE} $MICRO_HOME
-RUN mkdir -p $BIN_HOME
-COPY *.sh $BIN_HOME
-RUN chmod 755 $BIN_HOME/*
-RUN ln -s /logs $MICRO_HOME/logs
-RUN mkdir /logs
+WORKDIR $MICRO_HOME
+COPY maven/fproxy/ .
+RUN chmod 755 $BIN_HOME/* && \
+    mkdir /logs && \
+    ln -s /logs $MICRO_HOME/logs
 # Create the appuser
-RUN groupadd -r appgroup && \
-    useradd -r -u 1001 -g appgroup appuser && \
+RUN addgroup --system appgroup && \
+    adduser --system --uid 1001 --ingroup appgroup appuser && \
     chown -R appuser:appgroup $MICRO_HOME && \
     chmod 777 /logs
 USER appuser
+
 CMD ["/opt/app/fproxy/bin/start.sh"]
index 6708b3e..b0df6f2 100644 (file)
@@ -55,7 +55,7 @@
                <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
                <spring.web.version>5.1.3.RELEASE</spring.web.version>
 
-               <docker.location>${basedir}/target</docker.location>
+               <docker.location>${basedir}/target/build</docker.location>
                <!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> -->
 
        </properties>
index e789287..8e4ac38 100644 (file)
                <version>2.1.14-SNAPSHOT</version>
        </parent>
 
+       <properties>
+               <fproxy.build.dir>${project.build.directory}/${project.artifactId}-build/</fproxy.build.dir>
+       </properties>
+
        <artifactId>rproxy</artifactId>
        <packaging>jar</packaging>
 
                                <configuration>
                                        <reuseForks>false</reuseForks>
                                        <forkCount>1</forkCount>
+                                       <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                                </configuration>
                        </plugin>
                        <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>3.0.2</version>
+                               <artifactId>maven-assembly-plugin</artifactId>
+                               <configuration>
+                                       <descriptors>
+                                               <descriptor>src/main/assembly/descriptor.xml</descriptor>
+                                       </descriptors>
+                               </configuration>
                                <executions>
                                        <execution>
-                                               <id>copy-docker-file</id>
+                                               <id>make-assembly</id>
                                                <phase>package</phase>
                                                <goals>
-                                                       <goal>copy-resources</goal>
+                                                       <goal>single</goal>
                                                </goals>
-                                               <configuration>
-                                                       <outputDirectory>target</outputDirectory>
-                                                       <overwrite>true</overwrite>
-                                                       <resources>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/docker</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/bin/</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                       </resources>
-                                               </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
-                               <groupId>com.spotify</groupId>
+                               <groupId>io.fabric8</groupId>
                                <artifactId>docker-maven-plugin</artifactId>
-                               <version>0.4.11</version>
+                               <version>0.28.0</version>
                                <configuration>
                                        <verbose>true</verbose>
+                                       <apiVersion>${docker.apiVersion}</apiVersion>
+                                       <pullRegistry>${docker.pull.registry}</pullRegistry>
+                                       <pushRegistry>${docker.push.registry}</pushRegistry>
                                        <serverId>docker-hub</serverId>
-                                       <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
                                        <dockerDirectory>${docker.location}</dockerDirectory>
                                        <imageTags>
                                                <imageTag>latest</imageTag>
                                        </imageTags>
                                        <forceTags>true</forceTags>
+                                       <images>
+                                               <image>
+                                                       <name>${docker.push.registry}/onap/${project.artifactId}</name>
+                                                       <build>
+                                                               <cleanup>try</cleanup>
+                                                               <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
+                                                               <tags>
+                                                                       <tag>latest</tag>
+                                                               </tags>
+                                                               <assembly>
+                                                                       <inline>
+                                                                               <fileSets>
+                                                                                       <fileSet>
+                                                                                               <directory>${fproxy.build.dir}</directory>
+                                                                                               <outputDirectory>/${project.artifactId}</outputDirectory>
+                                                                                       </fileSet>
+                                                                               </fileSets>
+                                                                       </inline>
+                                                               </assembly>
+                                                       </build>
+                                               </image>
+                                       </images>
                                </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>generate-images</id>
+                                               <phase>install</phase>
+                                               <!--unbind default goal for this phase-->
+                                       </execution>
+                                       <execution>
+                                               <id>push-images</id>
+                                               <phase>deploy</phase>
+                                               <goals>
+                                                       <goal>push</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
diff --git a/sidecar/rproxy/src/main/assembly/descriptor.xml b/sidecar/rproxy/src/main/assembly/descriptor.xml
new file mode 100644 (file)
index 0000000..16b21de
--- /dev/null
@@ -0,0 +1,29 @@
+<assembly xmlns="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http_://www.__w3.org/2001/XMLSchema-instance"
+          xsi:SchemaLocation="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http_://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>build</id>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <formats>
+        <format>dir</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/bin</directory>
+            <outputDirectory>/bin</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.build.directory}</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>*.jar</include>
+            </includes>
+            <excludes>           
+            <exclude>Dockerfile</exclude>
+                <exclude>*.sh</exclude>
+            </excludes>
+        </fileSet>
+    </fileSets>
+</assembly>
index 56b32fa..6311e9e 100644 (file)
@@ -1,34 +1,26 @@
-FROM ubuntu:14.04
+FROM openjdk:8-alpine
 
 ARG MICRO_HOME=/opt/app/rproxy
 ARG BIN_HOME=$MICRO_HOME/bin
 ARG JAR_FILE=rproxy-exec.jar
 
-RUN apt-get update
-
-# Install and setup java8
-RUN apt-get update && apt-get install -y software-properties-common
-## sudo -E is required to preserve the environment. If you remove that line, it will most like freeze at this step
-RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk
-
-RUN sudo dpkg --purge --force-depends ca-certificates-java
-RUN sudo apt-get install ca-certificates-java
+RUN apk update && \
+    apk add ca-certificates
 
 ## Setup JAVA_HOME, this is useful for docker commandline
-ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)
+ENV JAVA_HOME usr/lib/jvm/java-1.8-openjdk
 RUN export JAVA_HOME
 
 # Build up the deployment folder structure
 RUN mkdir -p $MICRO_HOME
-COPY ${JAR_FILE} $MICRO_HOME
-RUN mkdir -p $BIN_HOME
-COPY *.sh $BIN_HOME
-RUN chmod 755 $BIN_HOME/*
-RUN ln -s /logs $MICRO_HOME/logs
-RUN mkdir /logs
+WORKDIR $MICRO_HOME
+COPY maven/rproxy/ .
+RUN chmod 755 $BIN_HOME/* && \
+    mkdir /logs && \
+    ln -s /logs $MICRO_HOME/logs
 # Create the appuser
-RUN groupadd -r appgroup && \
-    useradd -r -u 1001 -g appgroup appuser && \
+RUN addgroup --system appgroup && \
+    adduser --system -u 1001 -g appgroup appuser && \
     chown -R appuser:appgroup $MICRO_HOME && \
     chmod 777 /logs
 USER appuser
index be88bb3..d734322 100644 (file)
@@ -37,7 +37,7 @@
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <version.io.fabric8.fabric8-maven-plugin>3.5.32</version.io.fabric8.fabric8-maven-plugin>
-               <docker.location>${basedir}/target</docker.location>
+               <docker.location>${project.basedir}/target/${project.artifactId}-${project.version}-build</docker.location>
                <!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> -->
        </properties>
 
                                        </execution>
                                </executions>
                        </plugin>
+                       
+                       <plugin>
+                               <artifactId>maven-assembly-plugin</artifactId>
+                               <configuration>
+                                       <descriptors>
+                                               <descriptor>src/main/assembly/descriptor.xml</descriptor>
+                                       </descriptors>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>make-assembly</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>single</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
 
                        <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>3.0.2</version>
+                                       <groupId>io.fabric8</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>0.28.0</version>
+                                       <configuration>
+                                       <verbose>true</verbose>
+                                       <apiVersion>${docker.apiVersion}</apiVersion>
+                                       <pullRegistry>${docker.pull.registry}</pullRegistry>
+                                       <pushRegistry>${docker.push.registry}</pushRegistry>
+                                       <images>
+                                               <image>
+                                                       <name>${docker.push.registry}/onap/${project.artifactId}</name>
+                                                       <build>
+                                                               <cleanup>try</cleanup>
+                                                                       <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
+                                                               <tags>
+                                                                       <tag>latest</tag>
+                                                               </tags>
+                                                                       <assembly>
+                                                                       <inline>
+                                                                               <fileSets>
+                                                                                       <fileSet>
+                                                                                               <directory>${docker.location}</directory>
+                                                                                               <outputDirectory>/${project.artifactId}</outputDirectory>
+                                                                                       </fileSet>
+                                                                               </fileSets>
+                                                                       </inline>
+                                                               </assembly>
+                                                       </build>
+                                               </image>
+                                       </images>
+                               </configuration>
                                <executions>
-                                       <execution>
-                                               <id>copy-docker-file</id>
-                                               <phase>package</phase>
-                                               <goals>
-                                                       <goal>copy-resources</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <outputDirectory>target</outputDirectory>
-                                                       <overwrite>true</overwrite>
-                                                       <resources>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/docker</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                               <resource>
-                                                                       <directory>${basedir}/src/main/bin/</directory>
-                                                                       <filtering>true</filtering>
-                                                               </resource>
-                                                       </resources>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
-                       <plugin>
-                               <groupId>com.spotify</groupId>
-                               <artifactId>docker-maven-plugin</artifactId>
-                               <version>0.4.11</version>
-                               <configuration>
-                                       <verbose>true</verbose>
-                                       <serverId>docker-hub</serverId>
-                                       <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
-                                       <dockerDirectory>${docker.location}</dockerDirectory>
-                                       <imageTags>
-                                               <imageTag>latest</imageTag>
-                                       </imageTags>
-                                       <forceTags>true</forceTags>
-                               </configuration>
+                                       <execution>
+                                               <id>generate-images</id>
+                                               <phase>install</phase>
+                                               <!--unbind default goal for this phase-->
+                                       </execution>
+                                       <execution>
+                                               <id>push-images</id>
+                                               <phase>deploy</phase>
+                                               <goals>
+                                                       <goal>push</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
                        </plugin>
+
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-deploy-plugin</artifactId>
diff --git a/sidecar/tproxy-config/src/main/assembly/descriptor.xml b/sidecar/tproxy-config/src/main/assembly/descriptor.xml
new file mode 100644 (file)
index 0000000..b53f64e
--- /dev/null
@@ -0,0 +1,18 @@
+<assembly xmlns="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http_://www.__w3.org/2001/XMLSchema-instance"
+          xsi:SchemaLocation="http_://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http_://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>build</id>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <formats>
+        <format>dir</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/bin</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+</assembly>
index b95cf74..4851a20 100644 (file)
@@ -1,6 +1,6 @@
 FROM alpine:3.6
 RUN apk add --update iptables curl bash
-COPY start.sh /start.sh
+COPY maven/tproxy-config/start.sh /start.sh
 RUN chmod 755 /start.sh
 #CMD start.sh
 ENTRYPOINT ["/start.sh"]