1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-30 12:24:14 +01:00

Modified dockerfile to install in virtualenv

This commit is contained in:
Caleb Stewart 2021-06-16 16:10:48 -04:00
parent 81e3f2071d
commit f4c01af113

View File

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