Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Docker: Ignore git, logs, docs, temp and build files (#1182)

bcoles8247c2d095e4
diff --git a/.dockerignore b/.dockerignore
index 429b6c1a..546f942a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,5 +1,18 @@
+.git/
+
+build
+dist
+*.egg-info
+*.egg/
+*.pyc
+*.swp
+
venv/
cache/
+log/
spiderfoot.db*
+spiderfoot.test.db
-*.log
+__pycache__
+htmlcov/
+docs/
diff --git a/Dockerfile b/Dockerfile
index e0edbe14..4ef98513 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,7 +26,11 @@
#
# sudo docker run --rm spiderfoot sf.py -h
#
+# Running a shell in the container for maintenance
+# sudo docker run -it --entrypoint /bin/sh spiderfoot
+#
# Running spiderfoot unit tests in container
+#
# sudo docker build -t spiderfoot-test --build-arg REQUIREMENTS=requirements_test.txt .
# sudo docker run --rm spiderfoot-test -m pytest --flake8 .
@@ -47,6 +51,8 @@ RUN pip3 install -r "$REQUIREMENTS"
FROM alpine:3.12.4
WORKDIR /home/spiderfoot
+ENV SPIDERFOOT_LOGS /home/spiderfoot/log
+
# Place database and configs outside installation directory
ENV SPIDERFOOT_DATA /var/lib/spiderfoot
@@ -59,14 +65,11 @@ RUN apk --update --no-cache add python3 musl openssl libxslt tinyxml libxml2 jpe
&& rm -rf /lib/apk/db \
&& rm -rf /root/.cache \
&& mkdir $SPIDERFOOT_DATA \
+ && mkdir $SPIDERFOOT_LOGS \
+ && chown spiderfoot:spiderfoot $SPIDERFOOT_LOGS \
&& chown spiderfoot:spiderfoot $SPIDERFOOT_DATA
COPY . .
-
-# fix permissions on logs directory
-ENV SPIDERFOOT_LOGS /home/spiderfoot/log
-RUN chown spiderfoot:spiderfoot $SPIDERFOOT_LOGS
-
COPY --from=build /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"