Med-X_25.10.8 / Dockerfile
DeepRat's picture
Upload 43 files
64eded8 verified
# MedeX - Medical AI System
# Dockerfile for Hugging Face Spaces deployment
FROM python:3.10-slim
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy requirements first for better caching
COPY --chown=user requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=user . .
# Create necessary directories
RUN mkdir -p $HOME/app/rag_cache && \
mkdir -p $HOME/app/logs && \
mkdir -p $HOME/app/cache
# Expose Streamlit default port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:7860/_stcore/health || exit 1
# Set environment variables for Streamlit
# Note: CORS and XSRF settings are controlled by .streamlit/config.toml
ENV STREAMLIT_SERVER_PORT=7860 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Run the Streamlit app
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]