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"]