shaliz-kong commited on
Commit
6d2e051
·
1 Parent(s): 12d2187

debuging hf 503 error

Browse files
Files changed (2) hide show
  1. Dockerfile +7 -32
  2. supervisord.conf +4 -21
Dockerfile CHANGED
@@ -1,43 +1,18 @@
1
  FROM python:3.11-slim
2
 
3
- # Install Redis and Supervisor
4
  RUN apt-get update && apt-get install -y redis-server supervisor && rm -rf /var/lib/apt/lists/*
5
 
6
- # Install Python dependencies
7
  COPY requirements.txt /tmp/
8
  RUN pip install --no-cache-dir -r /tmp/requirements.txt
9
 
10
- # Copy application
11
  COPY . /app
12
  WORKDIR /app
13
 
14
- # Create supervisord config using heredoc (works on HF builder)
15
- RUN cat > /etc/supervisord.conf << 'EOF'
16
- [supervisord]
17
- nodaemon=true
18
 
19
- [program:redis]
20
- command=redis-server --bind 127.0.0.1 --port 6379 --maxmemory 128mb
21
- autostart=true
22
- autorestart=true
23
-
24
- [program:app]
25
- command=python -m uvicorn app.main:app --host 0.0.0.0 --port 7860
26
- directory=/app
27
- environment=REDIS_URL=redis://localhost:6379
28
- autostart=true
29
- autorestart=true
30
-
31
- [program:scheduler]
32
- command=python /app/scheduler_loop.py
33
- directory=/app
34
- environment=REDIS_URL=redis://localhost:6379
35
- autostart=true
36
- autorestart=true
37
- EOF
38
-
39
- # Expose port
40
- EXPOSE 7860
41
-
42
- # Start supervisord
43
- CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
 
1
  FROM python:3.11-slim
2
 
3
+ # Install Redis + Supervisor
4
  RUN apt-get update && apt-get install -y redis-server supervisor && rm -rf /var/lib/apt/lists/*
5
 
6
+ # Install Python deps
7
  COPY requirements.txt /tmp/
8
  RUN pip install --no-cache-dir -r /tmp/requirements.txt
9
 
10
+ # Copy app
11
  COPY . /app
12
  WORKDIR /app
13
 
14
+ # Copy supervisord config
15
+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 
 
16
 
17
+ # Start
18
+ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
supervisord.conf CHANGED
@@ -1,32 +1,15 @@
1
  [supervisord]
2
  nodaemon=true
3
- logfile=/var/log/supervisor/supervisord.log
4
- pidfile=/var/run/supervisord.pid
5
 
6
  [program:redis]
7
- command=/usr/bin/redis-server /etc/redis/redis.conf
8
  autostart=true
9
  autorestart=true
10
- priority=1
11
- stdout_logfile=/var/log/supervisor/redis.log
12
- stderr_logfile=/var/log/supervisor/redis_error.log
13
- startsecs=2 # Wait 2 seconds to ensure Redis is ready
14
 
15
- [program:uvicorn]
16
- command=python -m uvicorn app.main:app --host 0.0.0.0 --port 7860 --workers 1
17
  directory=/app
18
- autostart=true
19
- autorestart=true
20
- priority=2
21
- stdout_logfile=/var/log/supervisor/uvicorn.log
22
- stderr_logfile=/var/log/supervisor/uvicorn_error.log
23
- startsecs=3 # Wait for Redis to be ready
24
 
25
  [program:scheduler]
26
  command=python /app/scheduler_loop.py
27
- directory=/app
28
- autostart=true
29
- autorestart=true
30
- priority=3
31
- stdout_logfile=/var/log/supervisor/scheduler.log
32
- stderr_logfile=/var/log/supervisor/scheduler_error.log
 
1
  [supervisord]
2
  nodaemon=true
 
 
3
 
4
  [program:redis]
5
+ command=redis-server --bind 127.0.0.1 --port 6379
6
  autostart=true
7
  autorestart=true
 
 
 
 
8
 
9
+ [program:app]
10
+ command=python -m uvicorn app.main:app --host 0.0.0.0 --port 7860
11
  directory=/app
 
 
 
 
 
 
12
 
13
  [program:scheduler]
14
  command=python /app/scheduler_loop.py
15
+ directory=/app