container: clean apt caches and upgrade setuptools for CVE fix
All checks were successful
CI / Lint & Format (push) Successful in 22s
CI / Security Scan (push) Successful in 21s
CI / Advanced Security Tests (push) Successful in 15s
CI / Memory Leak Check (push) Successful in 19s
CI / Security Tests (push) Successful in 25s
CI / Unit Tests (push) Successful in 33s
CI / SBOM Generation (push) Successful in 19s
CI / Build & Push Image (push) Successful in 32s
All checks were successful
CI / Lint & Format (push) Successful in 22s
CI / Security Scan (push) Successful in 21s
CI / Advanced Security Tests (push) Successful in 15s
CI / Memory Leak Check (push) Successful in 19s
CI / Security Tests (push) Successful in 25s
CI / Unit Tests (push) Successful in 33s
CI / SBOM Generation (push) Successful in 19s
CI / Build & Push Image (push) Successful in 32s
This commit is contained in:
@@ -7,15 +7,19 @@ FROM python:3.11-slim AS builder
|
|||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies and clean up
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gcc \
|
gcc \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
# Create virtual environment
|
# Create virtual environment
|
||||||
RUN python -m venv /opt/venv
|
RUN python -m venv /opt/venv
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
# Upgrade pip/setuptools first (pulls in security-fixed jaraco.context)
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt gunicorn
|
RUN pip install --no-cache-dir -r requirements.txt gunicorn
|
||||||
@@ -27,8 +31,9 @@ FROM python:3.11-slim
|
|||||||
LABEL maintainer="FlaskPaste"
|
LABEL maintainer="FlaskPaste"
|
||||||
LABEL description="Lightweight secure pastebin REST API"
|
LABEL description="Lightweight secure pastebin REST API"
|
||||||
|
|
||||||
# Create non-root user
|
# Clean base image caches and create non-root user
|
||||||
RUN groupadd -r flaskpaste && useradd -r -g flaskpaste flaskpaste
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||||
|
&& groupadd -r flaskpaste && useradd -r -g flaskpaste flaskpaste
|
||||||
|
|
||||||
# Copy virtual environment from builder
|
# Copy virtual environment from builder
|
||||||
COPY --from=builder /opt/venv /opt/venv
|
COPY --from=builder /opt/venv /opt/venv
|
||||||
|
|||||||
Reference in New Issue
Block a user