Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +20 -3
Dockerfile
CHANGED
|
@@ -12,7 +12,7 @@ RUN mkdir -p /var/lib/nginx/body /var/lib/nginx/proxy && \
|
|
| 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; include /etc/nginx/sites-enabled/*; }" >> /etc/nginx/nginx.conf
|
| 16 |
|
| 17 |
COPY <<EOF /etc/nginx/sites-enabled/default
|
| 18 |
server {
|
|
@@ -27,19 +27,35 @@ server {
|
|
| 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 |
}
|
| 31 |
|
| 32 |
location /v1/ {
|
| 33 |
proxy_pass http://127.0.0.1:8880/v1/;
|
| 34 |
proxy_set_header Host \$host;
|
| 35 |
proxy_set_header X-Real-IP \$remote_addr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
}
|
| 38 |
EOF
|
| 39 |
|
| 40 |
# Environment setup
|
| 41 |
ENV HOST=0.0.0.0
|
| 42 |
-
ENV PORT=
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# ONNX optimization for 2 CPU environment
|
| 45 |
ENV ONNX_MAX_INSTANCES=2
|
|
@@ -51,7 +67,8 @@ ENV VOICE_CACHE_SIZE=1
|
|
| 51 |
COPY <<EOF /start.sh
|
| 52 |
#!/bin/bash
|
| 53 |
nginx &
|
| 54 |
-
|
|
|
|
| 55 |
EOF
|
| 56 |
|
| 57 |
RUN chmod +x /start.sh && \
|
|
|
|
| 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 {
|
|
|
|
| 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
|
|
|
|
| 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 && \
|