Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mvn build inside dockerfile #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.93/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/
Expand Down