-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: docker multistage builds (#320)
* build: docker multistage builds allow repeatable builds without a need to install java/maven locally Signed-off-by: Andrew Berezovskyi <andriib@kth.se> * fix: parent POM Signed-off-by: Andrew Berezovskyi <andriib@kth.se> * fix: test compose config Signed-off-by: Andrew Berezovskyi <andriib@kth.se> * fix: paths Signed-off-by: Andrew Berezovskyi <andriib@kth.se> --------- Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
- Loading branch information
1 parent
7d39f96
commit d5495ab
Showing
27 changed files
with
412 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
overlays/ | ||
target/ | ||
*/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
version: "3.9" | ||
services: | ||
server-rm: | ||
build: | ||
context: server-rm/ | ||
dockerfile: tomcat.Dockerfile | ||
context: ./ | ||
dockerfile: ./server-rm/tomcat.Dockerfile | ||
ports: | ||
- "8800:8080" | ||
server-cm: | ||
build: | ||
context: server-cm/ | ||
dockerfile: tomcat.Dockerfile | ||
context: ./ | ||
dockerfile: ./server-cm/tomcat.Dockerfile | ||
ports: | ||
- "8801:8080" | ||
server-qm: | ||
build: | ||
context: server-qm/ | ||
dockerfile: tomcat.Dockerfile | ||
context: ./ | ||
dockerfile: ./server-qm/tomcat.Dockerfile | ||
ports: | ||
- "8802:8080" | ||
server-am: | ||
build: | ||
context: server-am/ | ||
dockerfile: tomcat.Dockerfile | ||
context: ./ | ||
dockerfile: ./server-am/tomcat.Dockerfile | ||
ports: | ||
- "8803:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
version: "3.9" | ||
services: | ||
server-rm: | ||
build: server-rm/ | ||
build: | ||
context: ./ | ||
dockerfile: server-rm/Dockerfile | ||
ports: | ||
- "8800:8080" | ||
- "127.0.0.1:8800:8080" | ||
server-cm: | ||
build: server-cm/ | ||
build: | ||
context: ./ | ||
dockerfile: server-cm/Dockerfile | ||
ports: | ||
- "8801:8080" | ||
- "127.0.0.1:8801:8080" | ||
server-qm: | ||
build: server-qm/ | ||
build: | ||
context: ./ | ||
dockerfile: server-qm/Dockerfile | ||
ports: | ||
- "8802:8080" | ||
- "127.0.0.1:8802:8080" | ||
server-am: | ||
build: server-am/ | ||
build: | ||
context: ./ | ||
dockerfile: server-am/Dockerfile | ||
ports: | ||
- "8803:8080" | ||
- "127.0.0.1:8803:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
version: "3.9" | ||
services: | ||
server-rm: | ||
build: ../../../../server-rm/ | ||
build: | ||
context: ../../../../ | ||
dockerfile: server-rm/Dockerfile | ||
server-cm: | ||
build: ../../../../server-cm/ | ||
build: | ||
context: ../../../../ | ||
dockerfile: server-cm/Dockerfile | ||
server-qm: | ||
build: ../../../../server-qm/ | ||
build: | ||
context: ../../../../ | ||
dockerfile: server-qm/Dockerfile | ||
server-am: | ||
build: ../../../../server-am/ | ||
build: | ||
context: ../../../../ | ||
dockerfile: server-am/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
overlays/ | ||
src/ | ||
target/**/* | ||
!target/*.war | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
FROM docker.io/library/maven:3-eclipse-temurin-21-alpine AS build | ||
|
||
COPY . /src | ||
WORKDIR /src | ||
RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-am -am | ||
|
||
FROM docker.io/library/jetty:12-jre21-eclipse-temurin | ||
# WARNING DO NOT CHANGE WORKDIR or set it back to what it was before | ||
# $JETTY_BASE must be correct before starting Jetty | ||
|
||
COPY target/*.war /var/lib/jetty/webapps/ROOT.war | ||
COPY --from=build /src/server-am/target/*.war /var/lib/jetty/webapps/ROOT.war | ||
|
||
RUN java -jar "$JETTY_HOME/start.jar" --add-modules=ee9-deploy,ee9-jsp,ee9-jstl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
FROM docker.io/library/maven:3-eclipse-temurin-17 AS build | ||
|
||
COPY . /src | ||
WORKDIR /src | ||
RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-am -am -Pwith-jstl-impl | ||
|
||
FROM docker.io/library/tomcat:10-jre17 | ||
|
||
# do not write log files, log everything to the Docker daemon | ||
COPY config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties | ||
COPY --from=build /src/server-am/config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties | ||
ENV CATALINA_OUT=/dev/null | ||
|
||
COPY target/*.war /usr/local/tomcat/webapps/ROOT.war | ||
COPY --from=build /src/server-am/target/*.war /usr/local/tomcat/webapps/ROOT.war |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
overlays/ | ||
src/ | ||
target/**/* | ||
!target/*.war | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
FROM docker.io/library/maven:3-eclipse-temurin-21-alpine AS build | ||
|
||
COPY . /src | ||
WORKDIR /src | ||
RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-cm -am | ||
|
||
FROM docker.io/library/jetty:12-jre21-eclipse-temurin | ||
# WARNING DO NOT CHANGE WORKDIR or set it back to what it was before | ||
# $JETTY_BASE must be correct before starting Jetty | ||
|
||
COPY target/*.war /var/lib/jetty/webapps/ROOT.war | ||
COPY --from=build /src/server-cm/target/*.war /var/lib/jetty/webapps/ROOT.war | ||
|
||
RUN java -jar "$JETTY_HOME/start.jar" --add-modules=ee9-deploy,ee9-jsp,ee9-jstl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
FROM docker.io/library/maven:3-eclipse-temurin-17 AS build | ||
|
||
COPY . /src | ||
WORKDIR /src | ||
RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-cm -am -Pwith-jstl-impl | ||
|
||
FROM docker.io/library/tomcat:10-jre17 | ||
|
||
# do not write log files, log everything to the Docker daemon | ||
COPY config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties | ||
COPY --from=build /src/server-cm/config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties | ||
ENV CATALINA_OUT=/dev/null | ||
|
||
COPY target/*.war /usr/local/tomcat/webapps/ROOT.war | ||
COPY --from=build /src/server-cm/target/*.war /usr/local/tomcat/webapps/ROOT.war |
Oops, something went wrong.