Skip to content

Commit

Permalink
Full implementation of "Update Webgoat Dockerfile to use entrypoints …
Browse files Browse the repository at this point in the history
…and commands WebGoat#523" based on the pull request of Nicklaus McClendon
  • Loading branch information
Nanne Baars committed Jan 17, 2019
1 parent ed490a5 commit dc5f988
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ services:
- WEBWOLF_PORT=9090
ports:
- "8080:8080"
- "9001:9001"
volumes:
- .:/home/webgoat/.webgoat
command: "java -Djava.security.egd=file:/dev/./urandom -jar /home/webgoat/webgoat.jar --server.port=8080 --server.address=0.0.0.0"
webwolf:
image: webgoat/webwolf
ports:
- "9090:9090"
command: bash -c "sleep 8 && java -Djava.security.egd=file:/dev/./urandom -jar /home/webwolf/webwolf.jar --server.port=9090 --server.address=0.0.0.0 --spring.datasource.url=jdbc:hsqldb:hsql://webgoat:9001/webgoat"
command: --spring.datasource.url=jdbc:hsqldb:hsql://webgoat:9001/webgoat --server.address=0.0.0.0
4 changes: 2 additions & 2 deletions scripts/build-all.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ SUCCESS=$?
nc -zv 127.0.0.1 9090 2>/dev/null
SUCCESS=${SUCCESS}$?

if [[ "${SUCCESS}" -eq 00 ]] ; then
if [[ "${SUCCESS}" -eq 0 ]] ; then
echo "WebGoat and or WebWolf are still running, please stop them first otherwise unit tests might fail!"
exit 127
fi


mvn clean install
sh mvnw clean install
if [[ "$?" -ne 0 ]] ; then
exit y$?
fi
Expand Down
5 changes: 4 additions & 1 deletion webgoat-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ USER webgoat
RUN cd /home/webgoat/; mkdir -p .webgoat-${webgoat_version}
COPY target/webgoat-server-${webgoat_version}.jar /home/webgoat/webgoat.jar

EXPOSE 8080
EXPOSE 8080

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/home/webgoat/webgoat.jar"]
CMD ["--server.port=8080", "--server.address=0.0.0.0"]
4 changes: 4 additions & 0 deletions webwolf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ RUN \

USER webwolf
COPY target/webwolf-${webwolf_version}.jar /home/webwolf/webwolf.jar
COPY start-webwolf.sh /home/webwolf

EXPOSE 9090

ENTRYPOINT ["/home/webwolf/start-webwolf.sh"]
CMD ["--server.port=9090", "--server.address=0.0.0.0"]
7 changes: 7 additions & 0 deletions webwolf/start-webwolf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Script to start WebWolf, it needs a valid database connection from WebGoat so we wait 8 seconds before starting
# WebWolf application

echo " Waiting for database to be available..."
sleep 8 && java -Djava.security.egd=file:/dev/./urandom -jar /home/webwolf/webwolf.jar $@

0 comments on commit dc5f988

Please sign in to comment.