Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- Dockerfile +4 -1
- startup.sh +2 -2
Dockerfile
CHANGED
|
@@ -26,7 +26,9 @@ RUN apk add --no-cache nginx
|
|
| 26 |
# Configure nginx to not run as daemon and redirect logs to stdout/stderr
|
| 27 |
RUN echo "daemon off;" >> /etc/nginx/nginx.conf && \
|
| 28 |
sed -i 's/error_log.*/error_log \/dev\/stderr error;/' /etc/nginx/nginx.conf && \
|
| 29 |
-
sed -i 's/access_log.*/access_log \/dev\/stdout;/' /etc/nginx/nginx.conf
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Create app directory
|
| 32 |
WORKDIR /app
|
|
@@ -63,6 +65,7 @@ RUN mkdir -p /var/lib/nginx/tmp/client_body /var/lib/nginx/tmp/proxy /var/lib/ng
|
|
| 63 |
chmod -R 755 /var/lib/nginx && \
|
| 64 |
chown -R nginx:nginx /var/lib/nginx && \
|
| 65 |
mkdir -p /run/nginx && \
|
|
|
|
| 66 |
chown -R nginx:nginx /usr/share/nginx/html
|
| 67 |
|
| 68 |
# Expose port 8501 for Hugging Face Spaces
|
|
|
|
| 26 |
# Configure nginx to not run as daemon and redirect logs to stdout/stderr
|
| 27 |
RUN echo "daemon off;" >> /etc/nginx/nginx.conf && \
|
| 28 |
sed -i 's/error_log.*/error_log \/dev\/stderr error;/' /etc/nginx/nginx.conf && \
|
| 29 |
+
sed -i 's/access_log.*/access_log \/dev\/stdout;/' /etc/nginx/nginx.conf && \
|
| 30 |
+
sed -i 's/user nginx;//' /etc/nginx/nginx.conf && \
|
| 31 |
+
sed -i '/pid/d' /etc/nginx/nginx.conf
|
| 32 |
|
| 33 |
# Create app directory
|
| 34 |
WORKDIR /app
|
|
|
|
| 65 |
chmod -R 755 /var/lib/nginx && \
|
| 66 |
chown -R nginx:nginx /var/lib/nginx && \
|
| 67 |
mkdir -p /run/nginx && \
|
| 68 |
+
chown -R nginx:nginx /run/nginx && \
|
| 69 |
chown -R nginx:nginx /usr/share/nginx/html
|
| 70 |
|
| 71 |
# Expose port 8501 for Hugging Face Spaces
|
startup.sh
CHANGED
|
@@ -7,5 +7,5 @@ NODE_PID=$!
|
|
| 7 |
# Give the server a moment to start
|
| 8 |
sleep 3
|
| 9 |
|
| 10 |
-
# Start nginx in the foreground
|
| 11 |
-
nginx
|
|
|
|
| 7 |
# Give the server a moment to start
|
| 8 |
sleep 3
|
| 9 |
|
| 10 |
+
# Start nginx in the foreground as nginx user
|
| 11 |
+
su -s /bin/sh -c "nginx" nginx
|