FROM python:3.12-slim-bookworm # git wird von SkillSpector selbst benötigt, um Git-Repos zu klonen und zu scannen RUN apt-get update && apt-get install -y --no-install-recommends \ git \ && rm -rf /var/lib/apt/lists/* # SkillSpector wird bei JEDEM Image-Build frisch vom main-Branch installiert. # Kein Versions-Pin -> ein Rebuild holt automatisch die aktuellste Version. RUN pip install --no-cache-dir 'skillspector @ git+https://github.com/NVIDIA/skillspector.git' WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . # Nicht als root laufen RUN useradd -m -u 1000 scanner \ && mkdir -p /app/scan-tmp \ && chown -R scanner:scanner /app USER scanner ENV PYTHONUNBUFFERED=1 \ SCAN_TMP_DIR=/app/scan-tmp EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/healthz', timeout=3)" CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "310", "app:app"]