Spaces:
Running
Running
| # syntax=docker/dockerfile:1 | |
| FROM python:3.11-slim | |
| # System deps (jeśli używasz psycopg2-binary, wystarczy ca-certificates) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates curl && rm -rf /var/lib/apt/lists/* | |
| # Dobre praktyki | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Nie-root user (HF i tak odpala jako uid 1000) | |
| RUN useradd -m appuser | |
| WORKDIR /app | |
| # Zależności | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Kod | |
| COPY . . | |
| # Entrypoint (migracje/init + start) | |
| COPY entrypoint.sh /entrypoint.sh | |
| RUN chmod +x /entrypoint.sh | |
| USER appuser | |
| EXPOSE 7860 | |
| # UWAGA: zmienne ze Spaces (DATABASE_URL, itp.) będą dostępne dopiero w runtime | |
| ENTRYPOINT ["/entrypoint.sh"] | |