Spaces:
Running
Running
| # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # Vcore AI Proxy โ Dockerfile | |
| # Build: docker build -t vcore-proxy . | |
| # Run: docker compose up -d | |
| # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # โโ Stage 1: dependency builder โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| FROM python:3.12-slim AS builder | |
| WORKDIR /build | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --prefix=/install -r requirements.txt | |
| # โโ Stage 2: runtime image โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| FROM python:3.12-slim AS runtime | |
| LABEL org.opencontainers.image.title="AI Model Studio" | |
| LABEL org.opencontainers.image.description="OpenAI compatible API proxy" | |
| # ่ฟ่กๆถ็ณป็ปไพ่ต | |
| RUN apt-get update \ | |
| -o Acquire::Retries=5 \ | |
| && apt-get install -y --no-install-recommends \ | |
| ca-certificates curl gosu \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ๅๅปบ้ root ็จๆท | |
| RUN groupadd -r vproxy && useradd -r -g vproxy -d /app -s /sbin/nologin vproxy | |
| WORKDIR /app | |
| # ไป builder ๅคๅถๅทฒๅฎ่ฃ ็ Python ๅ | |
| COPY --from=builder /install /usr/local | |
| # ๅคๅถๅบ็จไปฃ็ | |
| COPY --chown=vproxy:vproxy . . | |
| RUN mkdir -p /app/config.default \ | |
| && cp -a /app/config/. /app/config.default/ 2>/dev/null || true | |
| COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | |
| # ่ฟ่กๆถๅฏๅ็ฎๅฝ | |
| RUN mkdir -p /app/bin /app/logs /app/errors /app/config \ | |
| && chown -R vproxy:vproxy /app/bin /app/logs /app/errors /app/config \ | |
| && chmod +x /usr/local/bin/docker-entrypoint.sh | |
| VOLUME ["/app/config"] | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | |
| CMD curl -sf http://localhost:7860/health || exit 1 | |
| ENTRYPOINT ["docker-entrypoint.sh"] | |
| CMD ["python", "main.py"] | |