Skip to content

Commit

Permalink
Adding version number to Dockerfile as variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaars committed Oct 18, 2017
1 parent 1ecb430 commit d1729e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/deploy-webgoat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ cd webgoat-server

if [ "${BRANCH}" == "master" ] && [ ! -z "${TRAVIS_TAG}" ]; then
# If we push a tag to master this will update the LATEST Docker image and tag with the version number
docker build -f Dockerfile -t $REPO:latest -t $REPO:${TRAVIS_TAG} .
docker build --build-arg webgoat_version=${TRAVIS_TAG} -f Dockerfile -t $REPO:latest -t $REPO:${TRAVIS_TAG} .
docker push $REPO
elif [ ! -z "${TRAVIS_TAG}" ]; then
# Creating a tag build we push it to Docker with that tag
docker build -f Dockerfile -t $REPO:${TRAVIS_TAG} .
docker build --build-arg webgoat_version=${TRAVIS_TAG} -f Dockerfile -t $REPO:${TRAVIS_TAG} .
docker push $REPO
elif [ "${BRANCH}" == "develop" ]; then
docker build -f Dockerfile -t $REPO:snapshot .
Expand Down
5 changes: 3 additions & 2 deletions webgoat-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM openjdk:8-jre-slim

ARG webgoat_version=8.0-SNAPSHOT

RUN useradd --home-dir /home/webgoat --create-home -U webgoat

RUN apt-get update; apt-get install curl -y


COPY start.sh /home/webgoat/start.sh
RUN chmod +x /home/webgoat/start.sh

USER webgoat
RUN mkdir -p /home/webgoat/.embedmongo/linux
RUN curl -o /home/webgoat/.embedmongo/linux/mongodb-linux-x86_64-3.2.2.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.2.tgz
RUN cd /home/webgoat/; mkdir -p .webgoat
COPY target/webgoat-server-8.0-SNAPSHOT.jar /home/webgoat/webgoat.jar
COPY target/webgoat-server-${webgoat_version}.jar /home/webgoat/webgoat.jar

0 comments on commit d1729e8

Please sign in to comment.