Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +40 -5
Dockerfile
CHANGED
|
@@ -1,11 +1,46 @@
|
|
| 1 |
FROM ghcr.io/remsky/kokoro-fastapi-cpu:latest
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
ENV HOST=0.0.0.0
|
| 5 |
-
ENV PORT=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
# Expose the port HF Spaces expects
|
| 8 |
EXPOSE 7860
|
| 9 |
|
| 10 |
-
|
| 11 |
-
CMD ["uv", "run", "python", "-m", "uvicorn", "api.src.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM ghcr.io/remsky/kokoro-fastapi-cpu:latest
|
| 2 |
|
| 3 |
+
# Install nginx
|
| 4 |
+
USER root
|
| 5 |
+
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Configure nginx
|
| 8 |
+
COPY <<EOF /etc/nginx/sites-available/default
|
| 9 |
+
server {
|
| 10 |
+
listen 7860;
|
| 11 |
+
server_name _;
|
| 12 |
+
|
| 13 |
+
location / {
|
| 14 |
+
return 301 /web/;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
location /web/ {
|
| 18 |
+
proxy_pass http://localhost:8880/web/;
|
| 19 |
+
proxy_set_header Host \$host;
|
| 20 |
+
proxy_set_header X-Real-IP \$remote_addr;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
location /v1/ {
|
| 24 |
+
proxy_pass http://localhost:8880/v1/;
|
| 25 |
+
proxy_set_header Host \$host;
|
| 26 |
+
proxy_set_header X-Real-IP \$remote_addr;
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
EOF
|
| 30 |
+
|
| 31 |
+
# Environment setup
|
| 32 |
ENV HOST=0.0.0.0
|
| 33 |
+
ENV PORT=8880
|
| 34 |
+
|
| 35 |
+
# Start both nginx and FastAPI
|
| 36 |
+
COPY <<EOF /start.sh
|
| 37 |
+
#!/bin/bash
|
| 38 |
+
nginx
|
| 39 |
+
su appuser -c "uv run python -m uvicorn api.src.main:app --host 0.0.0.0 --port 8880"
|
| 40 |
+
EOF
|
| 41 |
+
|
| 42 |
+
RUN chmod +x /start.sh
|
| 43 |
|
|
|
|
| 44 |
EXPOSE 7860
|
| 45 |
|
| 46 |
+
CMD ["/start.sh"]
|
|
|