File tree Expand file tree Collapse file tree 3 files changed +42
-14
lines changed Expand file tree Collapse file tree 3 files changed +42
-14
lines changed Original file line number Diff line number Diff line change 1
- FROM tomcat
1
+ # Stage 1: Build Stage
2
+ FROM openjdk:8 as build
2
3
4
+ WORKDIR /app
5
+
6
+ # Copy the source code into the Docker image
3
7
COPY . .
4
8
5
- RUN apt-get update ; apt-get install maven default-jdk -y ; update-alternatives --config javac
9
+ # Install Maven and JDK, then build the project
10
+ RUN apt-get update && \
11
+ apt-get install -y maven && \
12
+ mvn clean package
13
+
14
+ # Stage 2: Runtime Stage
15
+ FROM tomcat:7.0.82
16
+
17
+ # Copy the WAR file built in the previous stage
18
+ COPY --from=build /app/target/*.war /usr/local/tomcat/webapps/
6
19
7
- RUN mvn clean package ; cp target/*.war /usr/local/tomcat/webapps/
20
+ # Copy the pre-prepared tomcat-users.xml to set up user roles
21
+ COPY default-tomcat.xml /usr/local/tomcat/conf/tomcat-users.xml
8
22
9
- CMD ["catalina.sh" ,"run" ]
23
+ # CMD to start Tomcat
24
+ CMD ["catalina.sh" , "run" ]
Original file line number Diff line number Diff line change 1
- javavulnlab :
2
- build : .
3
- ports :
4
- - 8080:8080
5
- links :
6
- - mysql
7
1
8
- mysql :
9
- image : mysql
10
- environment :
11
- - MYSQL_ROOT_PASSWORD=root
2
+ services :
3
+ jvl :
4
+ image : cspf/jvl
5
+ build :
6
+ dockerfile : ./Dockerfile
7
+ context : ./
8
+ ports :
9
+ - 8080:8080
10
+ links :
11
+ - mysql
12
+
13
+ mysql :
14
+ image : mysql:5.7
15
+ environment :
16
+ MYSQL_ROOT_PASSWORD : root
17
+ MYSQL_ROOT_HOST : " %"
18
+ MYSQL_DATABASE : abc
19
+ command :
20
+ - " --default-authentication-plugin=mysql_native_password"
Original file line number Diff line number Diff line change 44
44
<build >
45
45
<finalName >JavaVulnerableLab</finalName >
46
46
</build >
47
+ <properties >
48
+ <maven .compiler.source>1.7</maven .compiler.source>
49
+ <maven .compiler.target>1.7</maven .compiler.target>
50
+ </properties >
47
51
</project >
You can’t perform that action at this time.
0 commit comments