Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files123456789101112131415161718192021222324252627282930313233# Use a slim Python base imageFROM python:3.9-slim# Set working directoryWORKDIR /app# Install system dependencies (including curl for the health check)RUN apt-get update && apt-get install -y \build-essential \curl \&& rm -rf /var/lib/apt/lists/*# Copy requirements to leverage Docker cacheCOPY requirements.txt .# Install Python dependenciesRUN pip install --no-cache-dir -r requirements.txt# Copy all application files (including app.py and the .streamlit folder)COPY . .# Expose the port that Streamlit uses (8501 for Hugging Face Spaces)EXPOSE 8501# Set environment variables so Streamlit is accessible externallyENV STREAMLIT_SERVER_PORT=8501ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0# Health check to ensure the app is runningHEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1# Run the Streamlit application from app.pyCMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]12345678910111213141516171819202122232425262728FROM python:3.9-slimWORKDIR /app# Install system dependenciesRUN apt-get update && apt-get install -y \build-essential \libeigen3-dev \&& rm -rf /var/lib/apt/lists/*# Copy all necessary filesCOPY app.py cubic_cpp.cpp setup.py requirements.txt ./# Install Python dependenciesRUN pip install --no-cache-dir -r requirements.txt# Build C++ extensionRUN pip install -e .# Expose Streamlit portEXPOSE 8501# Set Streamlit environment variablesENV STREAMLIT_SERVER_PORT=8501ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0# Run the applicationCMD ["streamlit", "run", "app.py"]
Dockerfile+10-15