From ad99457a36324c1e3930edd90c49511580215b1d Mon Sep 17 00:00:00 2001 From: Dan Salmon Date: Thu, 14 Mar 2024 10:27:56 -0500 Subject: [PATCH 1/3] combine install layers --- web/Dockerfile | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 60054aaaf..eb52bedec 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -12,13 +12,11 @@ ENV DEBIAN_FRONTEND="noninteractive" \ DATABASE="postgres" ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -ENV GOROOT="/usr/local/go" ENV GOPATH=$HOME/go -ENV PATH="${PATH}:${GOROOT}/bin:${GOPATH}/bin" +ENV PATH="${PATH}:${GOPATH}/bin" # Install Python -RUN apt update -y && \ - apt update -y && \ +RUN apt update && \ apt install -y \ python3.10 \ python3-dev \ @@ -48,16 +46,15 @@ RUN apt install -y --no-install-recommends \ RUN add-apt-repository ppa:mozillateam/ppa # Download and install go 1.20 -RUN wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz -RUN tar -xvf go1.21.4.linux-amd64.tar.gz -RUN rm go1.21.4.linux-amd64.tar.gz -RUN mv go /usr/local +RUN wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz && \ + tar -xvf go1.21.4.linux-amd64.tar.gz go/bin/go --strip-components=2 && \ + rm go1.21.4.linux-amd64.tar.gz && \ + mv go /usr/local/bin/ # Download geckodriver -RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz -RUN tar -xvf geckodriver-v0.32.0-linux64.tar.gz -RUN rm geckodriver-v0.32.0-linux64.tar.gz -RUN mv geckodriver /usr/bin +RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && \ + tar -xvf geckodriver-v0.32.0-linux64.tar.gz -C /usr/bin/ && \ + rm geckodriver-v0.32.0-linux64.tar.gz # Make directory for app WORKDIR /usr/src/app From 937405144345c9f05fedcd19521c9a0b86efdf61 Mon Sep 17 00:00:00 2001 From: Dan Salmon Date: Thu, 14 Mar 2024 15:48:39 -0500 Subject: [PATCH 2/3] delete go modules --- web/Dockerfile | 62 +++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index eb52bedec..625707e70 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -12,8 +12,9 @@ ENV DEBIAN_FRONTEND="noninteractive" \ DATABASE="postgres" ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 +ENV GOROOT="/usr/local/go" ENV GOPATH=$HOME/go -ENV PATH="${PATH}:${GOPATH}/bin" +ENV PATH="${PATH}:${GOROOT}/bin:${GOPATH}/bin" # Install Python RUN apt update && \ @@ -47,9 +48,8 @@ RUN add-apt-repository ppa:mozillateam/ppa # Download and install go 1.20 RUN wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz && \ - tar -xvf go1.21.4.linux-amd64.tar.gz go/bin/go --strip-components=2 && \ - rm go1.21.4.linux-amd64.tar.gz && \ - mv go /usr/local/bin/ + tar -xvf go1.21.4.linux-amd64.tar.gz -C /usr/local/ && \ + rm go1.21.4.linux-amd64.tar.gz # Download geckodriver RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && \ @@ -64,44 +64,37 @@ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Download Go packages -RUN go install -v github.com/jaeles-project/gospider@latest -RUN go install -v github.com/tomnomnom/gf@latest -RUN go install -v github.com/tomnomnom/unfurl@latest -RUN go install -v github.com/tomnomnom/waybackurls@latest -RUN go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest -RUN go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest -RUN go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest -RUN go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest -RUN go install -v github.com/hakluke/hakrawler@latest -RUN go install -v github.com/lc/gau/v2/cmd/gau@latest -RUN go install -v github.com/jaeles-project/gospider@latest -RUN go install -v github.com/owasp-amass/amass/v3/...@latest -RUN go install -v github.com/ffuf/ffuf@latest -RUN go install -v github.com/projectdiscovery/tlsx/cmd/tlsx@latest -RUN go install -v github.com/hahwul/dalfox/v2@latest -RUN go install -v github.com/projectdiscovery/katana/cmd/katana@latest -RUN go install -v github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest -RUN go install -v github.com/sa7mon/s3scanner@latest +RUN printf "\ + github.com/jaeles-project/gospider@latest\n\ + github.com/tomnomnom/gf@latest\n\ + github.com/tomnomnom/unfurl@latest\n\ + github.com/tomnomnom/waybackurls@latest\n\ + github.com/projectdiscovery/httpx/cmd/httpx@latest\n\ + github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest\n\ + github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest\n\ + github.com/projectdiscovery/naabu/v2/cmd/naabu@latest\n\ + github.com/hakluke/hakrawler@latest\n\ + github.com/lc/gau/v2/cmd/gau@latest\n\ + github.com/jaeles-project/gospider@latest\n\ + github.com/owasp-amass/amass/v3/...@latest\n\ + github.com/ffuf/ffuf@latest\n\ + github.com/projectdiscovery/tlsx/cmd/tlsx@latest\n\ + github.com/hahwul/dalfox/v2@latest\n\ + github.com/projectdiscovery/katana/cmd/katana@latest\n\ + github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest\n\ + github.com/sa7mon/s3scanner@latest\n" | \ + xargs -L1 go install -v && \ + rm -rf /go/pkg/* # Update Nuclei and Nuclei-Templates -RUN nuclei -update RUN nuclei -update-templates -# Update project discovery tools -RUN httpx -up -RUN naabu -up -RUN subfinder -up -RUN tlsx -up -RUN katana -up - # Copy requirements COPY ./requirements.txt /tmp/requirements.txt RUN pip3 install --upgrade setuptools pip && \ pip3 install -r /tmp/requirements.txt - # install eyewitness - RUN python3 -m pip install fuzzywuzzy \ selenium==4.9.1 \ python-Levenshtein \ @@ -109,7 +102,4 @@ RUN python3 -m pip install fuzzywuzzy \ netaddr # Copy source code -COPY . /usr/src/app/ - -# httpx seems to have issue, use alias instead!!! -RUN echo 'alias httpx="/go/bin/httpx"' >> ~/.bashrc +COPY . /usr/src/app/ \ No newline at end of file From a9bc2a218981711380b99945fbdfe3fd41016f04 Mon Sep 17 00:00:00 2001 From: Dan Salmon Date: Fri, 15 Mar 2024 11:25:16 -0500 Subject: [PATCH 3/3] squeeze image --- web/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 625707e70..740b10484 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -24,7 +24,7 @@ RUN apt update && \ python3-pip # Install essential packages -RUN apt install -y --no-install-recommends \ +RUN apt install -y --no-install-recommends \ build-essential \ cmake \ geoip-bin \ @@ -64,6 +64,7 @@ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Download Go packages +ENV GO111MODULE=on RUN printf "\ github.com/jaeles-project/gospider@latest\n\ github.com/tomnomnom/gf@latest\n\ @@ -83,8 +84,8 @@ RUN printf "\ github.com/projectdiscovery/katana/cmd/katana@latest\n\ github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest\n\ github.com/sa7mon/s3scanner@latest\n" | \ - xargs -L1 go install -v && \ - rm -rf /go/pkg/* + xargs -L1 go install -ldflags="-s -w" -v && \ + rm -rf /go/pkg/* && rm -rf /root/.cache/go-build # Update Nuclei and Nuclei-Templates RUN nuclei -update-templates @@ -92,10 +93,10 @@ RUN nuclei -update-templates # Copy requirements COPY ./requirements.txt /tmp/requirements.txt RUN pip3 install --upgrade setuptools pip && \ - pip3 install -r /tmp/requirements.txt + pip3 install -r /tmp/requirements.txt --no-cache-dir # install eyewitness -RUN python3 -m pip install fuzzywuzzy \ +RUN python3 -m pip install --no-cache-dir fuzzywuzzy \ selenium==4.9.1 \ python-Levenshtein \ pyvirtualdisplay \