Skip to content

Commit 8ffd57c

Browse files
committed
Update Dockerfile and .dockerignore to enhance build efficiency and exclude runtime data
- Modified the Dockerfile to utilize jq for extracting download URLs, improving reliability in fetching the latest versions of dependencies. - Added new entries to .dockerignore to exclude runtime data directories (results/, logs/, owasp-dependency-check-data/) from the Docker build context, optimizing the build process.
1 parent 0b55135 commit 8ffd57c

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

.dockerignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ htmlcov/
5555
# Build artifacts
5656
build/
5757
dist/
58-
*.egg-info/
58+
*.egg-info/
59+
60+
# Runtime data directories (mounted as volumes)
61+
results/
62+
logs/
63+
owasp-dependency-check-data/

Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ RUN pip3 install flask
3333
RUN pip3 install requests # Added for LLM connector
3434

3535
# Install Trivy (always latest)
36-
RUN export TRIVY_URL=$(wget -qO- https://api.github.com/repos/aquasecurity/trivy/releases/latest | grep browser_download_url | grep Linux-64bit.deb | cut -d '"' -f 4) && \
36+
RUN export TRIVY_URL=$(wget -qO- https://api.github.com/repos/aquasecurity/trivy/releases/latest | jq -r '.assets[] | select(.name | test("Linux-64bit.deb")) | .browser_download_url') && \
3737
wget -O trivy.deb $TRIVY_URL && \
3838
dpkg -i trivy.deb && \
3939
rm trivy.deb
4040

4141
# Install CodeQL CLI
42-
RUN export CODEQL_URL=$(wget -qO- https://api.github.com/repos/github/codeql-cli-binaries/releases/latest | grep browser_download_url | grep codeql-linux64.zip | cut -d '"' -f 4) && \
42+
RUN export CODEQL_URL=$(wget -qO- https://api.github.com/repos/github/codeql-cli-binaries/releases/latest | jq -r '.assets[] | select(.name | test("codeql-linux64.zip")) | .browser_download_url') && \
4343
wget -O codeql.zip $CODEQL_URL && \
4444
unzip codeql.zip -d /opt && \
4545
rm codeql.zip && \
4646
ln -s /opt/codeql/codeql /usr/local/bin/codeql
4747

4848
# Install Nuclei CLI
49-
RUN export NUCLEI_URL=$(wget -qO- https://api.github.com/repos/projectdiscovery/nuclei/releases/latest | grep browser_download_url | grep nuclei.*linux.*amd64.zip | cut -d '"' -f 4) && \
49+
RUN export NUCLEI_URL=$(wget -qO- https://api.github.com/repos/projectdiscovery/nuclei/releases/latest | jq -r '.assets[] | select(.name | test("nuclei.*linux.*amd64.zip")) | .browser_download_url') && \
5050
wget -O nuclei.zip $NUCLEI_URL && \
5151
unzip nuclei.zip -d /opt && \
5252
rm nuclei.zip && \
5353
ln -s /opt/nuclei /usr/local/bin/nuclei
5454

5555
# Install OWASP Dependency Check
56-
RUN export OWASP_DC_URL=$(wget -qO- https://api.github.com/repos/jeremylong/DependencyCheck/releases/latest | grep browser_download_url | grep dependency-check-.*release.zip | grep -v ant | grep -v asc | cut -d '"' -f 4) && \
56+
RUN export OWASP_DC_URL=$(wget -qO- https://api.github.com/repos/jeremylong/DependencyCheck/releases/latest | jq -r '.assets[] | select(.name | test("dependency-check.*release.zip") and (test("ant") | not) and (test("asc") | not)) | .browser_download_url') && \
5757
wget -O dependency-check.zip $OWASP_DC_URL && \
5858
unzip dependency-check.zip -d /opt && \
5959
rm dependency-check.zip && \
@@ -82,14 +82,14 @@ RUN pip3 install wapiti3 && \
8282
pip3 install --force-reinstall --no-cache-dir "typing_extensions>=4.14.1"
8383

8484
# Install TruffleHog CLI
85-
RUN export TRUFFLEHOG_URL=$(wget -qO- https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest | grep browser_download_url | grep trufflehog.*linux.*amd64.tar.gz | cut -d '"' -f 4) && \
85+
RUN export TRUFFLEHOG_URL=$(wget -qO- https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest | jq -r '.assets[] | select(.name | test("trufflehog.*linux.*amd64.tar.gz")) | .browser_download_url') && \
8686
wget -O trufflehog.tar.gz $TRUFFLEHOG_URL && \
8787
tar -xvzf trufflehog.tar.gz -C /opt && \
8888
rm trufflehog.tar.gz && \
8989
ln -s /opt/trufflehog /usr/local/bin/trufflehog
9090

9191
# Install GitLeaks CLI
92-
RUN export GITLEAKS_URL=$(wget -qO- https://api.github.com/repos/gitleaks/gitleaks/releases/latest | grep browser_download_url | grep gitleaks.*linux_x64.tar.gz | cut -d '"' -f 4) && \
92+
RUN export GITLEAKS_URL=$(wget -qO- https://api.github.com/repos/gitleaks/gitleaks/releases/latest | jq -r '.assets[] | select(.name | test("gitleaks.*linux_x64.tar.gz")) | .browser_download_url') && \
9393
wget -O gitleaks.tar.gz $GITLEAKS_URL && \
9494
tar -xvzf gitleaks.tar.gz -C /opt && \
9595
rm gitleaks.tar.gz && \
@@ -133,7 +133,7 @@ RUN wget https://raw.githubusercontent.com/zaproxy/zaproxy/main/docker/zap_commo
133133
RUN pip3 install kube-hunter
134134

135135
# Install Kube-bench (Kubernetes compliance testing tool)
136-
RUN export KUBE_BENCH_URL=$(wget -qO- https://api.github.com/repos/aquasecurity/kube-bench/releases/latest | grep browser_download_url | grep kube-bench.*linux.*amd64.tar.gz | cut -d '"' -f 4) && \
136+
RUN export KUBE_BENCH_URL=$(wget -qO- https://api.github.com/repos/aquasecurity/kube-bench/releases/latest | jq -r '.assets[] | select(.name | test("kube-bench.*linux.*amd64.tar.gz")) | .browser_download_url') && \
137137
wget -O kube-bench.tar.gz $KUBE_BENCH_URL && \
138138
tar -xvzf kube-bench.tar.gz -C /opt && \
139139
rm kube-bench.tar.gz && \
@@ -231,7 +231,5 @@ RUN cp -r /opt/ZAP_2.16.1/* /zap/
231231
# Symlink zap-x.sh to zap.sh for zap-baseline.py compatibility
232232
RUN ln -s /zap/zap.sh /zap/zap-x.sh
233233

234-
COPY scripts/webui.js /SimpleSecCheck/results/webui.js
235-
236234
WORKDIR /zap/wrk
237235
CMD ["bash"]

0 commit comments

Comments
 (0)