Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +2 -66
Dockerfile
CHANGED
|
@@ -1,61 +1,8 @@
|
|
| 1 |
FROM ghcr.io/remsky/kokoro-fastapi-cpu:latest
|
| 2 |
|
| 3 |
-
USER root
|
| 4 |
-
|
| 5 |
-
# Install nginx
|
| 6 |
-
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
-
# Configure nginx directories
|
| 9 |
-
RUN mkdir -p /var/lib/nginx/body /var/lib/nginx/proxy && \
|
| 10 |
-
chmod -R 777 /var/lib/nginx /var/log/nginx /var/run/ /var/lib/nginx/body /var/lib/nginx/proxy
|
| 11 |
-
|
| 12 |
-
# Configure nginx
|
| 13 |
-
RUN echo "daemon off; error_log /dev/stdout info; pid /tmp/nginx.pid;" > /etc/nginx/nginx.conf && \
|
| 14 |
-
echo "events { worker_connections 1024; }" >> /etc/nginx/nginx.conf && \
|
| 15 |
-
echo "http { access_log /dev/stdout; keepalive_timeout 65; keepalive_requests 100; include /etc/nginx/sites-enabled/*; }" >> /etc/nginx/nginx.conf
|
| 16 |
-
|
| 17 |
-
COPY <<EOF /etc/nginx/sites-enabled/default
|
| 18 |
-
server {
|
| 19 |
-
listen 7860;
|
| 20 |
-
server_name _;
|
| 21 |
-
|
| 22 |
-
location / {
|
| 23 |
-
return 301 /web/;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
location /web/ {
|
| 27 |
-
proxy_pass http://127.0.0.1:8880/web/;
|
| 28 |
-
proxy_set_header Host \$host;
|
| 29 |
-
proxy_set_header X-Real-IP \$remote_addr;
|
| 30 |
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
| 31 |
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
| 32 |
-
proxy_http_version 1.1;
|
| 33 |
-
proxy_set_header Upgrade \$http_upgrade;
|
| 34 |
-
proxy_set_header Connection "upgrade";
|
| 35 |
-
proxy_read_timeout 90;
|
| 36 |
-
proxy_connect_timeout 90;
|
| 37 |
-
proxy_send_timeout 90;
|
| 38 |
-
proxy_buffering off;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
location /v1/ {
|
| 42 |
-
proxy_pass http://127.0.0.1:8880/v1/;
|
| 43 |
-
proxy_set_header Host \$host;
|
| 44 |
-
proxy_set_header X-Real-IP \$remote_addr;
|
| 45 |
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
| 46 |
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
| 47 |
-
proxy_read_timeout 90;
|
| 48 |
-
proxy_connect_timeout 90;
|
| 49 |
-
proxy_send_timeout 90;
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
-
EOF
|
| 53 |
-
|
| 54 |
# Environment setup
|
| 55 |
ENV HOST=0.0.0.0
|
| 56 |
ENV PORT=7860
|
| 57 |
-
ENV FORWARDED_ALLOW_IPS="*"
|
| 58 |
-
ENV PROXY_HEADERS=1
|
| 59 |
|
| 60 |
# ONNX optimization for 2 CPU environment
|
| 61 |
ENV ONNX_MAX_INSTANCES=2
|
|
@@ -63,18 +10,7 @@ ENV ONNX_NUM_THREADS=2
|
|
| 63 |
ENV ONNX_INTER_OP_THREADS=1
|
| 64 |
ENV VOICE_CACHE_SIZE=1
|
| 65 |
|
| 66 |
-
# Start script
|
| 67 |
-
COPY <<EOF /start.sh
|
| 68 |
-
#!/bin/bash
|
| 69 |
-
nginx &
|
| 70 |
-
sleep 1
|
| 71 |
-
exec uv run python -m uvicorn api.src.main:app --host 0.0.0.0 --port 8880 --proxy-headers --forwarded-allow-ips="*"
|
| 72 |
-
EOF
|
| 73 |
-
|
| 74 |
-
RUN chmod +x /start.sh && \
|
| 75 |
-
chmod 777 /start.sh
|
| 76 |
-
|
| 77 |
-
USER appuser
|
| 78 |
EXPOSE 7860
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
| 1 |
FROM ghcr.io/remsky/kokoro-fastapi-cpu:latest
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Environment setup
|
| 4 |
ENV HOST=0.0.0.0
|
| 5 |
ENV PORT=7860
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# ONNX optimization for 2 CPU environment
|
| 8 |
ENV ONNX_MAX_INSTANCES=2
|
|
|
|
| 10 |
ENV ONNX_INTER_OP_THREADS=1
|
| 11 |
ENV VOICE_CACHE_SIZE=1
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
EXPOSE 7860
|
| 14 |
|
| 15 |
+
# Run FastAPI directly on port 7860
|
| 16 |
+
CMD ["uv", "run", "python", "-m", "uvicorn", "api.src.main:app", "--host", "0.0.0.0", "--port", "7860"]
|