Files
Strartup-product/pricing/app/Dockerfile
T

28 lines
1.8 KiB
Docker

# Startup Pricing Service image (course starter, adapted).
# Base image pinned by digest: python:3.13-slim, linux/amd64 compatible (Droplet is x86_64).
# Record of selection: see pricing/README.md. Rebuild and rescan when this digest changes.
FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90
# Security fix (Trivy, 2026-11-12): zlib1g fixed in the Debian 13 point update
# (CVE-2026-76844, CVE-2026-85091). Exact version, so the build stays reproducible.
# Security fix (Trivy, 2026-11-30, Jenkins #20): libzstd1 CVE-2026-124851 fixed in 1.5.7+dfsg-1+deb13u1
RUN apt-get update \
&& apt-get install -y --no-install-recommends --only-upgrade 'zlib1g=1:1.3.dfsg+really1.3.1-1+deb13u1' 'libzstd1=1.5.7+dfsg-1+deb13u1' \
&& rm -rf /var/lib/apt/lists/*
ARG APP_COMMIT=development
ARG APP_SEMVER=development
ENV APP_COMMIT=$APP_COMMIT APP_SEMVER=$APP_SEMVER PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
LABEL org.opencontainers.image.source="https://git.ssw590.abrdns.com/StartupTeam/Strartup-product" \
org.opencontainers.image.revision=$APP_COMMIT
WORKDIR /app
COPY requirements.txt .
# Exact, hash-locked direct and transitive dependencies (generated by pip-compile from requirements.in).
# pip is not needed at runtime; removing it also removes its vendored msgpack, urllib3
# and pkg_resources (setuptools), which Trivy reported as HIGH.
RUN pip install --no-cache-dir --require-hashes -r requirements.txt \
&& python -m pip uninstall -y pip
COPY app.py .
USER 10001:10001
EXPOSE 8000
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)"
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]