hermes-agent / Dockerfile
D3AMON's picture
Upload Dockerfile with huggingface_hub
cd3a741 verified
Raw History Blame Contribute Delete
1.08 kB
# Dockerfile for Hermes Agent on Hugging Face Spaces
# Uses Python 3.11 slim for minimal footprint
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV PYTHONPATH=/app
# Set work directory
WORKDIR /app
# Install system dependencies (for curl, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create non-root user for security (Hugging Face requirement)
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose port (Hugging Face Spaces uses 7860)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Start the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]