Spaces:
Sleeping
Sleeping
| # Use a slim official Python image as the base | |
| FROM python:3.10-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Install system dependencies needed for some Python packages (like 'build-essential' for compiling) | |
| # This step is often necessary to avoid errors during pip install | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file and install Python dependencies | |
| # This is done before copying the app code to leverage Docker layer caching | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the entire application code into the container | |
| # Assuming your Streamlit file is named 'streamlit_app.py' in the root | |
| COPY . /app | |
| # Expose the default Streamlit port | |
| EXPOSE 8501 | |
| # The ENTRYPOINT command that runs the Streamlit app when the container starts | |
| # --server.port=8501: Sets the port Streamlit listens on | |
| # --server.address=0.0.0.0: Makes the app accessible from outside the container | |
| ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |