Spaces:
Paused
Paused
| # AgentScope Agent Service Dockerfile | |
| # Multi-stage build for optimized production image | |
| # Build stage | |
| FROM python:3.11-slim AS builder | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --prefix=/install -r requirements.txt | |
| # Production stage | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Copy installed dependencies from builder | |
| COPY --from=builder /install /usr/local | |
| # Copy application code | |
| COPY agent_service.py . | |
| # Create non-root user for security | |
| RUN useradd --create-home --shell /bin/bash appuser | |
| USER appuser | |
| # Environment variables with defaults | |
| ENV AGENTSCOPE_MODEL_PROVIDER=dashscope | |
| ENV AGENTSCOPE_MODEL=qwen-max | |
| ENV AGENTSCOPE_HOST=0.0.0.0 | |
| ENV AGENTSCOPE_PORT=7860 | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 | |
| # Run the service | |
| CMD ["python", "agent_service.py"] | |