github-actions[bot]
Deploy b55d7879051e44b21c91f79cdd3684e50d841079 to HF Space
4b52401
Raw
History Blame Contribute Delete
1.23 kB
# Use a stable Python with wide binary wheel support
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PORT=8000
# System deps (just in case for wheels; slim can use these at runtime)
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install requirements first for better layer caching
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install -r requirements.txt
# Copy application
COPY backend ./backend
COPY web ./web
# Optional: allow overriding dataset URL and training sample size at runtime
ENV DATASET_URL="https://raw.githubusercontent.com/JayAtria-7/SkySense-Flight-Price-Predictor/main/Clean_Dataset.csv" \
MAX_TRAIN_ROWS=25000
# Expose port
EXPOSE 8000
# Healthcheck hitting API health endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -fsS http://127.0.0.1:${PORT}/api/health || exit 1
# Start FastAPI with uvicorn; use platform-provided $PORT if available (e.g., Hugging Face Spaces)
CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port ${PORT:-8000}"]