diff options
-rw-r--r-- | sidecar/fproxy/pom.xml | 112 | ||||
-rw-r--r-- | sidecar/fproxy/src/main/assembly/descriptor.xml | 29 | ||||
-rw-r--r-- | sidecar/fproxy/src/main/docker/Dockerfile | 31 | ||||
-rw-r--r-- | sidecar/pom.xml | 2 | ||||
-rw-r--r-- | sidecar/rproxy/pom.xml | 76 | ||||
-rw-r--r-- | sidecar/rproxy/src/main/assembly/descriptor.xml | 29 | ||||
-rw-r--r-- | sidecar/rproxy/src/main/docker/Dockerfile | 30 | ||||
-rw-r--r-- | sidecar/tproxy-config/pom.xml | 105 | ||||
-rw-r--r-- | sidecar/tproxy-config/src/main/assembly/descriptor.xml | 18 | ||||
-rw-r--r-- | sidecar/tproxy-config/src/main/docker/Dockerfile | 2 |
10 files changed, 291 insertions, 143 deletions
diff --git a/sidecar/fproxy/pom.xml b/sidecar/fproxy/pom.xml index 8875dd8..a84ee98 100644 --- a/sidecar/fproxy/pom.xml +++ b/sidecar/fproxy/pom.xml @@ -27,6 +27,10 @@ <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> @@ -116,50 +120,78 @@ <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 index 0000000..eb645f2 --- /dev/null +++ b/sidecar/fproxy/src/main/assembly/descriptor.xml @@ -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> diff --git a/sidecar/fproxy/src/main/docker/Dockerfile b/sidecar/fproxy/src/main/docker/Dockerfile index d91f0e3..4537e24 100644 --- a/sidecar/fproxy/src/main/docker/Dockerfile +++ b/sidecar/fproxy/src/main/docker/Dockerfile @@ -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"] diff --git a/sidecar/pom.xml b/sidecar/pom.xml index 6708b3e..b0df6f2 100644 --- a/sidecar/pom.xml +++ b/sidecar/pom.xml @@ -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> diff --git a/sidecar/rproxy/pom.xml b/sidecar/rproxy/pom.xml index e789287..8e4ac38 100644 --- a/sidecar/rproxy/pom.xml +++ b/sidecar/rproxy/pom.xml @@ -27,6 +27,10 @@ <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> @@ -128,50 +132,78 @@ <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 index 0000000..16b21de --- /dev/null +++ b/sidecar/rproxy/src/main/assembly/descriptor.xml @@ -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> diff --git a/sidecar/rproxy/src/main/docker/Dockerfile b/sidecar/rproxy/src/main/docker/Dockerfile index 56b32fa..6311e9e 100644 --- a/sidecar/rproxy/src/main/docker/Dockerfile +++ b/sidecar/rproxy/src/main/docker/Dockerfile @@ -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 diff --git a/sidecar/tproxy-config/pom.xml b/sidecar/tproxy-config/pom.xml index be88bb3..d734322 100644 --- a/sidecar/tproxy-config/pom.xml +++ b/sidecar/tproxy-config/pom.xml @@ -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> @@ -65,50 +65,73 @@ </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 index 0000000..b53f64e --- /dev/null +++ b/sidecar/tproxy-config/src/main/assembly/descriptor.xml @@ -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> diff --git a/sidecar/tproxy-config/src/main/docker/Dockerfile b/sidecar/tproxy-config/src/main/docker/Dockerfile index b95cf74..4851a20 100644 --- a/sidecar/tproxy-config/src/main/docker/Dockerfile +++ b/sidecar/tproxy-config/src/main/docker/Dockerfile @@ -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"] |