Spaces:
Sleeping
Sleeping
# Use Python 3.9 slim image as base, which is a good choice for stability and size. | |
FROM python:3.9-slim | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Install system dependencies required for RDKit and other graphical libraries. | |
# This is a crucial step for rdkit-pypi to work correctly in a Linux container. | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
g++ \ | |
libxext6 \ | |
libxrender1 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy the requirements file first to leverage Docker's layer caching. | |
# The Docker build will only re-run the pip install step if this file changes. | |
COPY requirements.txt . | |
# Install the Python dependencies specified in requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of your application code into the container | |
COPY . . | |
# Expose the port that Streamlit will run on. Hugging Face Spaces typically uses 7860. | |
EXPOSE 7860 | |
# Set environment variables for Streamlit to run in a headless environment. | |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 | |
ENV STREAMLIT_SERVER_PORT=7860 | |
ENV STREAMLIT_SERVER_HEADLESS=true | |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
# The command to run your Streamlit application when the container starts. | |
# It points to the app.py file and sets the server address and port. | |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |