T-SNE / Dockerfile
euler314's picture
Upload 8 files
29b4491 verified
Raw
History Blame Contribute Delete
1.35 kB
# Dockerfile for Hugging Face Spaces
# Multi-service: Streamlit UI + Flask MCP API with nginx reverse proxy
# All traffic goes through port 7860:
# https://your-space.hf.space/ → Streamlit UI
# https://your-space.hf.space/mcp/* → Flask MCP API
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
nginx \
supervisor \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and install Python dependencies
COPY requirements-hf.txt .
RUN pip install --no-cache-dir -r requirements-hf.txt
# Copy application files
COPY streamlit.py .
COPY mcp_flask_server.py .
COPY web ./web
# Configure nginx
COPY nginx.conf /etc/nginx/sites-available/default
RUN rm -f /etc/nginx/sites-enabled/default && \
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
# Configure supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create log directory
RUN mkdir -p /var/log/supervisor
# Expose only port 7860 (HF Spaces requirement)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl --fail http://localhost:7860/ || exit 1
# Start supervisor to manage all services
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]