From f4c01af1138db075ace3d2398deb0ed71673be33 Mon Sep 17 00:00:00 2001 From: Caleb Stewart Date: Wed, 16 Jun 2021 16:10:48 -0400 Subject: [PATCH] Modified dockerfile to install in virtualenv --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 894a533..7b99503 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,22 +16,23 @@ RUN set -eux \ RUN set -eux \ && python3 -m ensurepip -# Ensure pip is up to date -RUN set -eux \ - && python3 -m pip install -U pip setuptools wheel setuptools_rust - # Copy pwncat source COPY . /pwncat +# Setup virtual environment +RUN set -eux \ + && python3 -m venv /opt/pwncat \ + && /opt/pwncat/bin/python3 -m pip install -U pip setuptools wheel setuptools_rust + # Setup pwncat RUN set -eux \ && cd /pwncat \ - && python3 setup.py install + && /opt/pwncat/bin/python setup.py install # Cleanup RUN set -eux \ - && find /usr/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \ - && find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true + && find /opt/pwncat/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \ + && find /opt/pwncat/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true FROM alpine:latest as final @@ -43,11 +44,10 @@ RUN set -eux \ && find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true \ && mkdir /work -COPY --from=builder /usr/bin/pwncat /usr/bin/pwncat -COPY --from=builder /usr/lib/python3.8 /usr/lib/python3.8 +COPY --from=builder /opt/pwncat /opt/pwncat -RUN python3 -m pwncat --download-plugins +RUN /opt/pwncat/bin/python -m pwncat --download-plugins # Set working directory WORKDIR /work -ENTRYPOINT ["/usr/bin/pwncat"] +ENTRYPOINT ["/opt/pwncat/bin/pwncat"]