-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (36 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
45 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This dockerfile builds a container that pulls down and runs the latest version of BenchmarkJava
FROM ubuntu:22.04
LABEL org.opencontainers.image.authors="Dave Wichers dave.wichers@owasp.org"
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \
&& apt-get install -q -y \
openjdk-17-jre-headless \
openjdk-17-jdk \
git \
maven \
wget \
iputils-ping \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /owasp
WORKDIR /owasp
# Download, build, install Benchmark Utilities required by crawler and scorecard generation
RUN git clone https://github.com/OWASP-Benchmark/BenchmarkUtils.git \
&& cd BenchmarkUtils \
&& mvn install
# Download, build BenchmarkJava
RUN git clone https://github.com/OWASP-Benchmark/BenchmarkJava \
&& git config --global --add safe.directory /owasp/BenchmarkJava \
&& cd BenchmarkJava \
&& mvn clean package cargo:install
RUN useradd -d /home/bench -m -s /bin/bash bench \
&& echo bench:bench | chpasswd
RUN chown -R bench /owasp/
ENV PATH=/owasp/BenchmarkJava:$PATH
# Start up Benchmark once for 60 seconds then kill it, so additional runtime
# dependencies are downloaded and cached in the image.
# exit 0 prevents the timeout return code from failing the Docker build.
WORKDIR /owasp/BenchmarkJava
RUN timeout 60 ./runBenchmark.sh; exit 0
EXPOSE 8443
CMD ["./runBenchmark.sh"]