forked from username/flaskpaste
containerfile: remove vendored jaraco from setuptools, purge pip cache
This commit is contained in:
@@ -16,10 +16,11 @@ RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
RUN pip install --no-cache-dir --upgrade pip wheel
|
||||
|
||||
# Install Python dependencies (includes security pins for setuptools, jaraco.context)
|
||||
# Install Python dependencies (includes security pins from requirements.txt)
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt gunicorn \
|
||||
&& rm -rf /opt/venv/lib/python*/site-packages/setuptools/_vendor/jaraco.context*.dist-info
|
||||
&& pip cache purge 2>/dev/null || true \
|
||||
&& rm -rf /opt/venv/lib/python*/site-packages/setuptools/_vendor/jaraco*
|
||||
|
||||
|
||||
# Stage 2: Runtime image
|
||||
@@ -32,7 +33,8 @@ LABEL description="Lightweight secure pastebin REST API"
|
||||
# Note: System packages upgraded for Trivy scan; app runs from venv
|
||||
RUN apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& pip install --no-cache-dir --upgrade pip 'setuptools>=80.0' 'jaraco.context>=6.1.0' \
|
||||
&& rm -rf /usr/local/lib/python*/site-packages/setuptools/_vendor/jaraco.context*.dist-info \
|
||||
&& pip cache purge 2>/dev/null || true \
|
||||
&& rm -rf /root/.cache /usr/local/lib/python*/site-packages/setuptools/_vendor/jaraco* \
|
||||
&& groupadd -r flaskpaste && useradd -r -g flaskpaste flaskpaste
|
||||
|
||||
# Copy virtual environment from builder
|
||||
|
||||
Reference in New Issue
Block a user