From 514b78e2f74f90a5e4ed637419b7b730817119af Mon Sep 17 00:00:00 2001 From: SimonGurney Date: Mon, 4 Sep 2023 09:26:38 +0100 Subject: [PATCH 1/2] feat: mvn build inside dockerfile --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ef5fa5d..fd761609 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,11 @@ COPY --chown=gradle:gradle ./log4j-cve-2021-44228 /home/gradle/src WORKDIR /home/gradle/src RUN gradle :malicious-server:bootJar --no-daemon +FROM maven:3.8.6-openjdk-8 as maven +COPY . /home/app +WORKDIR /home/app +RUN mvn clean package + FROM openjdk:8u181-jdk-alpine RUN mkdir /app @@ -13,14 +18,14 @@ COPY --from=builder /home/gradle/src/malicious-server/build/libs/*.jar /app/mali RUN mkdir -p /usr/local/tomcat/ WORKDIR /usr/local/tomcat -RUN wget --no-check-certificate http://dlcdn.apache.org/tomcat/tomcat-8/v8.5.73/bin/apache-tomcat-8.5.73.tar.gz +RUN wget --no-check-certificate http://dlcdn.apache.org/tomcat/tomcat-8/v8.5.73/bin/apache-tomcat-8.5.93.tar.gz RUN tar xvfz apache*.tar.gz -RUN mv apache-tomcat-8.5.73/* /usr/local/tomcat/. +RUN mv apache-tomcat-8.5.93/* /usr/local/tomcat/. ADD start.sh /usr/local/tomcat/ # Copy the application to tomcat -ADD target/insecure-bank.war /usr/local/tomcat/webapps +COPY --from=maven /home/app/target/insecure-bank.war /usr/local/tomcat/webapps/insecure-bank.war # Copy the license file ADD license.hdiv /usr/local/tomcat/hdiv/ From 2f6fed270e5b9ce7e43fe54937fd9bae35dd87cc Mon Sep 17 00:00:00 2001 From: SimonGurney Date: Mon, 4 Sep 2023 09:31:13 +0100 Subject: [PATCH 2/2] fix: missed a tomcat version bump --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fd761609..27d29955 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ COPY --from=builder /home/gradle/src/malicious-server/build/libs/*.jar /app/mali RUN mkdir -p /usr/local/tomcat/ WORKDIR /usr/local/tomcat -RUN wget --no-check-certificate http://dlcdn.apache.org/tomcat/tomcat-8/v8.5.73/bin/apache-tomcat-8.5.93.tar.gz +RUN wget --no-check-certificate http://dlcdn.apache.org/tomcat/tomcat-8/v8.5.93/bin/apache-tomcat-8.5.93.tar.gz RUN tar xvfz apache*.tar.gz RUN mv apache-tomcat-8.5.93/* /usr/local/tomcat/.