Update root pom.xml for docker udc-containers

This commit is contained in:
Alexander Sharov 2018-09-29 02:02:13 +04:00
parent 164a8d3701
commit e2d5fac2ed
10 changed files with 122 additions and 45 deletions

View file

@ -27,9 +27,19 @@
<docker.baseImage>openjdk:8-jre</docker.baseImage>
<docker.repository>university-course</docker.repository>
<docker.registry.host>localhost</docker.registry.host>
<!-- Docker CLI executable -->
<dockerCli>docker</dockerCli>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
@ -37,20 +47,31 @@
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-docker-resources</id>
<id>docker-resources</id>
<phase>none</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/context</outputDirectory>
<includeEmptyDirs>true</includeEmptyDirs>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>docker-dependencies</id>
<phase>none</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/context</outputDirectory>
</configuration>
</execution>
</executions>
@ -67,12 +88,14 @@
</goals>
<configuration>
<skip>${docker.skip.build}</skip>
<executable>docker</executable>
<executable>${dockerCli}</executable>
<arguments>
<argument>build</argument>
<argument>-t</argument>
<argument>
${docker.registry.host}/${docker.repository}/${project.artifactId}:${project.version}
<argument>--force-rm</argument>
<argument>--label=project.groupid=${project.groupId}</argument>
<argument>--label=project.artifactid=${project.artifactId}</argument>
<argument>--label=project.version=${project.version}</argument>
<argument>--tag=${docker.registry.host}/${docker.repository}/${project.artifactId}:${project.version}
</argument>
<argument>${project.build.directory}/context</argument>
</arguments>
@ -86,7 +109,7 @@
</goals>
<configuration>
<skip>${docker.skip.push}</skip>
<executable>docker</executable>
<executable>${dockerCli}</executable>
<arguments>
<argument>push</argument>
<argument>

View file

@ -13,6 +13,21 @@
<artifactId>udc-backend-service</artifactId>
<name>UDC :: Containers :: Backend</name>
<dependencies>
<dependency>
<groupId>org.springframework.samples</groupId>
<artifactId>udc-backend</artifactId>
<version>${project.version}</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
@ -20,11 +35,8 @@
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-docker-resources</id>
<phase>install</phase>
<goals>
<goal>resources</goal>
</goals>
<id>docker-resources</id>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
@ -33,26 +45,8 @@
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework.samples</groupId>
<artifactId>udc-backend</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/target/context</outputDirectory>
<destFileName>${project.artifactId}.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
<id>docker-dependencies</id>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>

View file

@ -1,4 +1,4 @@
FROM openjdk:8-jre
FROM @docker.baseImage@
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
@ -14,8 +14,4 @@ RUN mkdir -p ${BASE_DIR}
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY udc-backend-*.jar /udc/apps/petclinic/todo.jar
LABEL project.groupid="${project.groupId}" \
project.artifactid="${project.artifactId}" \
project.version="${project.version}"
COPY udc-backend.jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -1 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
########################################################
#
# Name: entrypoint.sh
#
##########################################################
java -jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -0,0 +1,17 @@
FROM openjdk:8-jre
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=en_US.UTF-8
ENV BASE_DIR='/udc/apps/petclinic'
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]
RUN mkdir -p ${BASE_DIR}
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY udc-backend-*.jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
########################################################
#
# Name: entrypoint.sh
#
##########################################################
java -jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -0,0 +1,17 @@
FROM openjdk:8-jre
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=en_US.UTF-8
ENV BASE_DIR='/udc/apps/petclinic'
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]
RUN mkdir -p ${BASE_DIR}
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY udc-backend-*.jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
########################################################
#
# Name: entrypoint.sh
#
##########################################################
java -jar ${BASE_DIR}/udc-backend-service.jar

View file

@ -0,0 +1,4 @@
#Created by Apache Maven 3.5.4
version=1.0.0-SNAPSHOT
groupId=org.springframework.samples
artifactId=udc-backend-service