Pedot commited on
Commit
2a83bc3
·
1 Parent(s): 81df81c

Fix: nginx Dockerfile/supervisord — proper config symlink, daemon off at top, build-time validation

Browse files
Files changed (2) hide show
  1. Dockerfile +14 -7
  2. supervisord.conf +3 -1
Dockerfile CHANGED
@@ -6,7 +6,7 @@ WORKDIR /app
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  nginx supervisor curl && \
8
  rm -rf /var/lib/apt/lists/* && \
9
- mkdir -p /var/log/supervisor /var/run /run && \
10
  ln -sf /dev/stdout /var/log/nginx/access.log && \
11
  ln -sf /dev/stderr /var/log/nginx/error.log
12
 
@@ -15,13 +15,20 @@ RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  COPY . .
17
 
18
- # Nginx config
19
- COPY nginx.conf /etc/nginx/sites-enabled/default
20
- RUN rm -f /etc/nginx/sites-enabled/default 2>/dev/null; \
21
- cp /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default 2>/dev/null || true; \
22
- echo "daemon off;" >> /etc/nginx/nginx.conf
23
 
24
- # Build initial landing.html immediately
 
 
 
 
 
 
 
25
  RUN python /app/build_landing.py || true
26
 
27
  EXPOSE 80
 
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  nginx supervisor curl && \
8
  rm -rf /var/lib/apt/lists/* && \
9
+ mkdir -p /var/log/supervisor /var/run /run /var/log/nginx && \
10
  ln -sf /dev/stdout /var/log/nginx/access.log && \
11
  ln -sf /dev/stderr /var/log/nginx/error.log
12
 
 
15
 
16
  COPY . .
17
 
18
+ # Nginx: place config in sites-available and symlink
19
+ COPY nginx.conf /etc/nginx/sites-available/default
20
+ RUN rm -f /etc/nginx/sites-enabled/default && \
21
+ ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default && \
22
+ ls -la /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
23
 
24
+ # Nginx: disable daemon (supervisor runs it as foreground)
25
+ # Insert 'daemon off;' at the very TOP of nginx.conf (before events{} block)
26
+ RUN sed -i '1s/^/daemon off;\n/' /etc/nginx/nginx.conf
27
+
28
+ # Validate nginx config syntax at build time
29
+ RUN nginx -t
30
+
31
+ # Build initial landing.html
32
  RUN python /app/build_landing.py || true
33
 
34
  EXPOSE 80
supervisord.conf CHANGED
@@ -5,10 +5,12 @@ logfile=/var/log/supervisor/supervisord.log
5
  pidfile=/var/run/supervisord.pid
6
 
7
  [program:nginx]
8
- command=nginx -g "daemon off;"
9
  autostart=true
10
  autorestart=true
11
  priority=10
 
 
12
 
13
  [program:streamlit]
14
  command=streamlit run dashboard.py --server.port=7860 --server.address=127.0.0.1 --server.baseUrlPath=/dashboard
 
5
  pidfile=/var/run/supervisord.pid
6
 
7
  [program:nginx]
8
+ command=/usr/sbin/nginx
9
  autostart=true
10
  autorestart=true
11
  priority=10
12
+ stderr_logfile=/var/log/supervisor/nginx.err.log
13
+ stdout_logfile=/var/log/supervisor/nginx.out.log
14
 
15
  [program:streamlit]
16
  command=streamlit run dashboard.py --server.port=7860 --server.address=127.0.0.1 --server.baseUrlPath=/dashboard