Skip to content

Commit ea37ada

Browse files
egoebelbeckermaibin
authored andcommitted
BAEL-1614 - additions for docker (eugenp#4455)
1 parent 40d3b96 commit ea37ada

4 files changed

Lines changed: 37 additions & 1 deletion

File tree

‎spring-boot-ops/docker/Dockerfile‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Alpine Linux with OpenJDK JRE
2+
FROM openjdk:8-jre-alpine
3+
RUN apk add --no-cache bash
4+
5+
# copy fat WAR
6+
COPY spring-boot-ops.war /app.war
7+
8+
# copy fat WAR
9+
COPY logback.xml /logback.xml
10+
11+
COPY run.sh /run.sh
12+
13+
# runs application
14+
#CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=default", "-Dlogging.config=/logback.xml", "/app.war"]
15+
16+
ENTRYPOINT ["/run.sh"]

‎spring-boot-ops/docker/logback.xml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<include resource="org/springframework/boot/logging/logback/base.xml"/>
4+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
5+
<file>/var/log/WebjarsdemoApplication/application.log</file>
6+
<append>true</append>
7+
<encoder>
8+
<pattern>%-7d{yyyy-MM-dd HH:mm:ss:SSS} %m%n</pattern>
9+
</encoder>
10+
</appender>
11+
12+
<root level="INFO">
13+
<appender-ref ref="FILE" />
14+
</root>
15+
</configuration>

‎spring-boot-ops/docker/run.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
java -Dspring.profiles.active=$1 -Dlogging.config=/logback.xml -jar /app.war
4+

‎spring-boot-ops/pom.xml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@
137137
<goal>repackage</goal>
138138
</goals>
139139
<configuration>
140-
<mainClass>org.baeldung.boot.Application</mainClass>
140+
<mainClass>com.baeldung.webjar.WebjarsdemoApplication</mainClass>
141+
<outputDirectory>${project.basedir}/docker</outputDirectory>
141142
</configuration>
142143
</execution>
143144
</executions>

0 commit comments

Comments
 (0)