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
1 changed files with 11 additions and 11 deletions

View File

@ -16,22 +16,23 @@ RUN set -eux \
RUN set -eux \ RUN set -eux \
&& python3 -m ensurepip && 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 source
COPY . /pwncat 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 # Setup pwncat
RUN set -eux \ RUN set -eux \
&& cd /pwncat \ && cd /pwncat \
&& python3 setup.py install && /opt/pwncat/bin/python setup.py install
# Cleanup # Cleanup
RUN set -eux \ RUN set -eux \
&& find /usr/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \ && find /opt/pwncat/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 d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true
FROM alpine:latest as final 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 \ && find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true \
&& mkdir /work && mkdir /work
COPY --from=builder /usr/bin/pwncat /usr/bin/pwncat COPY --from=builder /opt/pwncat /opt/pwncat
COPY --from=builder /usr/lib/python3.8 /usr/lib/python3.8
RUN python3 -m pwncat --download-plugins RUN /opt/pwncat/bin/python -m pwncat --download-plugins
# Set working directory # Set working directory
WORKDIR /work WORKDIR /work
ENTRYPOINT ["/usr/bin/pwncat"] ENTRYPOINT ["/opt/pwncat/bin/pwncat"]