Skip to content

Commit

Permalink
docker-compose-update
Browse files Browse the repository at this point in the history
  • Loading branch information
CSPF-Founder authored Jun 20, 2024
1 parent 004fbac commit f96f204
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
23 changes: 19 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
FROM tomcat
# Stage 1: Build Stage
FROM openjdk:8 as build

WORKDIR /app

# Copy the source code into the Docker image
COPY . .

RUN apt-get update ; apt-get install maven default-jdk -y ; update-alternatives --config javac
# Install Maven and JDK, then build the project
RUN apt-get update && \
apt-get install -y maven && \
mvn clean package

# Stage 2: Runtime Stage
FROM tomcat:7.0.82

# Copy the WAR file built in the previous stage
COPY --from=build /app/target/*.war /usr/local/tomcat/webapps/

RUN mvn clean package ; cp target/*.war /usr/local/tomcat/webapps/
# Copy the pre-prepared tomcat-users.xml to set up user roles
COPY default-tomcat.xml /usr/local/tomcat/conf/tomcat-users.xml

CMD ["catalina.sh","run"]
# CMD to start Tomcat
CMD ["catalina.sh", "run"]
29 changes: 19 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
javavulnlab:
build: .
ports:
- 8080:8080
links:
- mysql

mysql:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
services:
jvl:
image: cspf/jvl
build:
dockerfile: ./Dockerfile
context: ./
ports:
- 8080:8080
links:
- mysql

mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: abc
command:
- "--default-authentication-plugin=mysql_native_password"
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@
<build>
<finalName>JavaVulnerableLab</finalName>
</build>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>

0 comments on commit f96f204

Please sign in to comment.