# Use Python 3.11 slim image FROM python:3.11-slim # Set working directory WORKDIR /app # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create a non-root user RUN useradd -m -u 1000 zynktime && \ chown -R zynktime:zynktime /app # Switch to non-root user USER zynktime # Expose port EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:8000/health')" || exit 1 # Run the application CMD ["python", "main.py"]