mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(docker): drop pip from the runtime image to clear the image scan
pip is only needed to install the Kobo cloudscraper requirements. Leaving it in the final image also leaves pip/_vendor/vendor.txt, which Trivy reads as installed msgpack 1.1.2 and setuptools 70.3.0 and fails the CRITICAL,HIGH gate. Neither is an application dependency, and setuptools is not present in the image as code at all. Verify by building both variants for linux/amd64 and scanning with Trivy 0.70.0 at the workflow's settings: the current layer exits 1 with exactly those two findings, the stripped layer exits 0. cloudscraper still imports and creates a scraper, and removing py3-pip orphans no runtime tooling. The setup:kobo-cloudscraper script still shells out to pip, but it needs tsx and only ever runs in local development, never in the image.
This commit is contained in:
@@ -49,10 +49,14 @@ ENV KOREADER_PLUGIN_PATH=/app/koreader-plugin/bookorbit.koplugin
|
||||
|
||||
COPY server/requirements/kobo-cloudscraper.txt /tmp/kobo-cloudscraper-requirements.txt
|
||||
|
||||
# pip is build-only here. Leaving it installed also leaves pip/_vendor/vendor.txt,
|
||||
# which Trivy reads as installed msgpack and setuptools and fails the image scan on.
|
||||
RUN apk upgrade --no-cache && \
|
||||
apk add --no-cache poppler-utils su-exec ffmpeg python3 py3-pip tini && \
|
||||
python3 -m venv /opt/bookorbit-python && \
|
||||
/opt/bookorbit-python/bin/python -m pip install --no-cache-dir -r /tmp/kobo-cloudscraper-requirements.txt && \
|
||||
/opt/bookorbit-python/bin/python -m pip uninstall -y pip && \
|
||||
apk del py3-pip && \
|
||||
rm -f /tmp/kobo-cloudscraper-requirements.txt && \
|
||||
rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx
|
||||
|
||||
|
||||
Reference in New Issue
Block a user