i'm trying to build docker image with python in it in obfuscated form, so i tried below method
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
COPY hello-world.py /
COPY requirments.txt /
RUN pip install -r requirments.txt
RUN pyarmor obfuscate 'hello-world.py'
RUN rm -rf hello-world.py
RUN cd dist
CMD ["python", "hello-world.py"]
i'm getting error at pyarmor command
INFO Start obfuscating the scripts...
INFO ello-world.py -> dist/ello-world.py
ERROR [Errno 2] No such file or directory: '/ello-world.py'
need some help
CodePudding user response:
Putting the original file outside of the root (/) seems to have fixed the issue:
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
WORKDIR /app
COPY hello-world.py .
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pyarmor obfuscate hello-world.py
RUN rm -rf hello-world.py
CMD ["python", "dist/hello-world.py"]
docker build -t obf-hello .
... <output omitted> ...
docker run -it --rm obf-hello
HELLO WORLD!