FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y \ gcc \ wget \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN groupadd -g 1000 app && \ useradd -u 1000 -g 1000 -m -s /bin/bash app COPY . . RUN mkdir -p logs data && \ chown -R app:app /app USER app ENV PYTHONPATH=/app ENV PYTHONUNBUFFERED=1 EXPOSE 8081 8082 HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8081/health || exit 1 CMD ["python", "main.py"]