Remsky commited on
Commit
3827848
·
verified ·
1 Parent(s): f78cb7f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -1,9 +1,14 @@
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 {
@@ -15,13 +20,13 @@ server {
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
  }
@@ -32,15 +37,9 @@ EOF
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"]
 
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
+ chown -R appuser:appuser /var/lib/nginx /var/log/nginx /var/run/ /var/lib/nginx/body /var/lib/nginx/proxy
11
+
12
  # Configure nginx
13
  COPY <<EOF /etc/nginx/sites-available/default
14
  server {
 
20
  }
21
 
22
  location /web/ {
23
+ proxy_pass http://127.0.0.1:8880/web/;
24
  proxy_set_header Host \$host;
25
  proxy_set_header X-Real-IP \$remote_addr;
26
  }
27
 
28
  location /v1/ {
29
+ proxy_pass http://127.0.0.1:8880/v1/;
30
  proxy_set_header Host \$host;
31
  proxy_set_header X-Real-IP \$remote_addr;
32
  }
 
37
  ENV HOST=0.0.0.0
38
  ENV PORT=8880
39
 
40
+ # Start script
41
  COPY <<EOF /start.sh
42
  #!/bin/bash
43
+ nginx -g 'daemon off;' &
44
+ uv run python -m uvicorn api.src.main:app --host 0.0.0.0 --port 8880
45
  EOF