FROM python:3.7 as buildimage RUN useradd -u 1000 -ms /bin/bash python WORKDIR /home/python USER python RUN python -m venv /home/python/venv # "Activate" the venv ENV PATH="/home/python/venv/bin:$PATH" COPY req.txt req.txt RUN pip install -r req.txt # COPY jam.h jam.h # COPY jamlib.a jamlib.a # COPY jamlib_build.py jamlib_build.py # RUN python jamlib_build.py RUN pip wheel --wheel-dir=/home/python/wheels -r req.txt RUN find . RUN ls -la RUN pip freeze FROM python:3.7-slim RUN useradd -u 1000 -ms /bin/bash python && \ apt update && \ apt install -y libgd3 WORKDIR /home/python USER python RUN python -m venv /home/python/venv # "Activate" the venv ENV PATH="/home/python/venv/bin:$PATH" COPY --from=buildimage /home/python/wheels /home/python/wheels COPY req.txt req.txt RUN pip install --no-index --find-links=/home/python/wheels -r req.txt COPY --from=buildimage /home/python/_pi_cffi.* /home/python/ # COPY --from=buildimage /home/python/venv/lib/python3.7/site-packages/.libs_cffi_backend /home/python/venv/lib/python3.7/site-packages/ # CMD ["python", "tcp-proxy.py"]