crashappsec / chalk

Chalk allows you to follow code from development, through builds and into production.
https://crashoverride.com/
GNU General Public License v3.0
322 stars 11 forks source link

Chalk breaks distroless python3 images #327

Closed miki725 closed 2 weeks ago

miki725 commented 3 weeks ago

Seems like in distroless python images, virtualenv packages cannot be imported when wrapped with chalk:

➜ echo '
  FROM debian:11-slim AS build
  RUN apt-get update && \\
      apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \\
      python3 -m venv /venv && \\
      /venv/bin/pip install requests

  FROM gcr.io/distroless/python3-debian11
  COPY --from=build /venv /venv
  ENTRYPOINT ["/venv/bin/python3", "-c", "import os, pprint; print(os.getcwd()); pprint.pprint(dict(os.environ)); import requests; print(requests.get(\'https://google.com\').status_code)"]
  ' | ./chalk docker build -t test -f - .  --progress=plain; and docker run -it --rm test

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'