Skip to content

Commit

Permalink
Docker: Ignore git, logs, docs, temp and build files (smicallef#1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoles authored Jun 13, 2021
1 parent 5841672 commit 8247c2d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 14 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
.git/

build
dist
*.egg-info
*.egg/
*.pyc
*.swp

venv/
cache/
log/
spiderfoot.db*
spiderfoot.test.db

*.log
__pycache__
htmlcov/
docs/
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

Expand All @@ -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

Expand All @@ -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"

Expand Down

0 comments on commit 8247c2d

Please sign in to comment.