BAEL-1614 - Docker with Java Guest Post (#4474)

* BAEL-1614 - additions for docker

* BAEL-1614 - move docker project to guest module
This commit is contained in:
Eric Goebelbecker 2018-06-13 11:15:57 -04:00 committed by maibin
parent b59da11c66
commit 272f018f90
6 changed files with 52 additions and 3 deletions

View File

@ -1,3 +1,2 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -0,0 +1,16 @@
# Alpine Linux with OpenJDK JRE
FROM openjdk:8-jre-alpine
RUN apk add --no-cache bash
# copy fat WAR
COPY spring-boot-app-0.0.1-SNAPSHOT.war /app.war
# copy fat WAR
COPY logback.xml /logback.xml
COPY run.sh /run.sh
# runs application
#CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=default", "-Dlogging.config=/logback.xml", "/app.war"]
ENTRYPOINT ["/run.sh"]

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>/var/log/Application/application.log</file>
<append>true</append>
<encoder>
<pattern>%-7d{yyyy-MM-dd HH:mm:ss:SSS} %m%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>

View File

@ -0,0 +1,4 @@
#!/bin/sh
java -Dspring.profiles.active=$1 -Dlogging.config=/logback.xml -jar /app.war

View File

@ -51,6 +51,22 @@
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>com.stackify.Application</mainClass>
<outputDirectory>${project.basedir}/docker</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@ -58,4 +74,4 @@
<tomcat.version>8.0.43</tomcat.version>
</properties>
</project>
</project>

View File

@ -138,7 +138,6 @@
</goals>
<configuration>
<mainClass>com.baeldung.webjar.WebjarsdemoApplication</mainClass>
<outputDirectory>${project.basedir}/docker</outputDirectory>
</configuration>
</execution>
</executions>