diff options
Diffstat (limited to 'sidecar/fproxy')
-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 |
3 files changed, 113 insertions, 59 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"] |