FROM python:3.9 # Environment Variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PYTHONPATH=/app # Setting pip timeout globally via environment variable is often more reliable ENV PIP_DEFAULT_TIMEOUT=1000 WORKDIR /app # Install dependencies COPY requirements.txt . # Adding --retries helps if the connection drops during the 800MB download RUN pip install --upgrade pip && \ pip install --no-cache-dir --timeout=1000 --retries 10 -r requirements.txt # Copy code COPY src/ ./src/ COPY config/ ./config/ COPY scripts/ ./scripts/ COPY data/ ./data/ COPY tests/ ./tests/ # Port FastAPI EXPOSE 8081 # Copy the entrypoint script COPY entrypoint.sh /app/entrypoint.sh # Make it executable (Crucial!) RUN chmod +x /app/entrypoint.sh # Set the Entrypoint ENTRYPOINT ["/app/entrypoint.sh"] # Default command - can be overridden CMD ["python", "src/main.py"]