mimo1972's picture
Update Dockerfile
61d40de verified
#1. Base Image: Use a pre-configured Python environment (like a fresh OS install)
FROM python:3.11-slim
# 2. Setup: Create a folder inside the container to hold your app
WORKDIR /app
# 3. Dependencies: Copy the requirements file first to cache the installation step
# (This makes re-building faster if you only change your code but not libraries)
COPY requirements.txt .
# 4. Install: Run pip to install pandas, streamlit, scikit-learn, etc.
RUN pip install --no-cache-dir -r requirements.txt
# 5. Application Code: Copy all your files (streamlit.py, models, datasets) into the container
COPY . .
# 6. Execution: The command to start the application
# Hugging Face SPECIFIC: You must use port 7860 and address 0.0.0.0
CMD ["streamlit", "run", "flightprice.py", "--server.port", "7860", "--server.address", "0.0.0.0"]