Added support to build an Docker container to run it on Raspberry Pi (#329)
Added support to build an Docker container to run it on Raspberry Pi #329
This commit is contained in:
parent
2b9185d85f
commit
26ab0dc712
31
README.MD
31
README.MD
@ -93,18 +93,47 @@ The source code will be available in the home directory.
|
|||||||
|
|
||||||
# Building a new Docker image
|
# Building a new Docker image
|
||||||
|
|
||||||
WebGoat now has Docker support you can build a container with the following commands:
|
WebGoat now has Docker support for x86 and ARM (raspberry pi).
|
||||||
|
### Docker on x86
|
||||||
|
On x86 you can build a container with the following commands:
|
||||||
|
|
||||||
```Shell
|
```Shell
|
||||||
cd WebGoat/
|
cd WebGoat/
|
||||||
mvn package
|
mvn package
|
||||||
cd webgoat-container
|
cd webgoat-container
|
||||||
|
mvn package
|
||||||
mvn docker:build
|
mvn docker:build
|
||||||
docker tag webgoat/webgoat-8.0 webgoat/webgoat-8.0:8.0
|
docker tag webgoat/webgoat-8.0 webgoat/webgoat-8.0:8.0
|
||||||
docker login
|
docker login
|
||||||
docker push webgoat/webgoat-container
|
docker push webgoat/webgoat-container
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker on ARM (Raspberry Pi)
|
||||||
|
On a Raspberry Pi (it has yet been tested with a Raspberry Pi 3 and the hypriot Docker image) you need to build JFFI for
|
||||||
|
ARM first. This is needed by the docker-maven-plugin ([see here](https://github.com/spotify/docker-maven-plugin/issues/233)):
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
sudo apt-get install build-essential
|
||||||
|
git clone https://github.com/jnr/jffi.git
|
||||||
|
cd jffi
|
||||||
|
ant jar
|
||||||
|
cd build/jni
|
||||||
|
sudo cp libjffi-1.2.so /usr/lib
|
||||||
|
```
|
||||||
|
|
||||||
|
When you have done this you can build the Docker container using the following commands:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
cd WebGoat/
|
||||||
|
mvn package
|
||||||
|
cd webgoat-container
|
||||||
|
mvn package
|
||||||
|
mvn docker:build -Drpi=true
|
||||||
|
docker tag webgoat/webgoat-8.0 webgoat/webgoat-8.0:8.0
|
||||||
|
docker login
|
||||||
|
docker push webgoat/webgoat-container
|
||||||
|
```
|
||||||
|
|
||||||
With the following command you are able to run the Docker container on your local machine:
|
With the following command you are able to run the Docker container on your local machine:
|
||||||
|
|
||||||
```Shell
|
```Shell
|
||||||
|
@ -17,22 +17,43 @@
|
|||||||
<start-class>org.owasp.webgoat.WebGoat</start-class>
|
<start-class>org.owasp.webgoat.WebGoat</start-class>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>raspberry-pi-3</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>rpi</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
<build>
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.spotify</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>0.4.10</version>
|
||||||
|
<configuration>
|
||||||
|
<imageName>webgoat/webgoat-8.0</imageName>
|
||||||
|
<dockerDirectory>src/main/docker_rpi3</dockerDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/java</directory>
|
<targetPath>/</targetPath>
|
||||||
</resource>
|
<directory>${project.build.directory}</directory>
|
||||||
<resource>
|
<include>${project.build.finalName}.war</include>
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
<includes>
|
|
||||||
<include>**/application.properties</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>default</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>!rpi</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.spotify</groupId>
|
<groupId>com.spotify</groupId>
|
||||||
@ -50,6 +71,28 @@
|
|||||||
</resources>
|
</resources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/application.properties</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
10
webgoat-container/src/main/docker_rpi3/Dockerfile
Normal file
10
webgoat-container/src/main/docker_rpi3/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Baseimage specially for raspberry pi usage
|
||||||
|
FROM resin/rpi-raspbian:jessie
|
||||||
|
VOLUME /tmp
|
||||||
|
# Installing openjdk-8-headless like in the standard Webgoat Docker container
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
openjdk-8-jre-headless
|
||||||
|
RUN cd /root; mkdir -p .webgoat
|
||||||
|
ADD webgoat-container-8.0-SNAPSHOT.war webgoat.jar
|
||||||
|
RUN sh -c 'touch /webgoat.jar'
|
||||||
|
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/webgoat.jar"]
|
Loading…
x
Reference in New Issue
Block a user