Spaces:
Sleeping
Sleeping
Add logs to docker to see why HF space fails
Browse files- Dockerfile +17 -4
Dockerfile
CHANGED
@@ -7,14 +7,16 @@ USER root
|
|
7 |
# Create necessary directories for Grobid
|
8 |
RUN mkdir -m 777 -p /opt/grobid/grobid-home/tmp
|
9 |
|
10 |
-
# Give permissions to the default supervisord log directory
|
11 |
RUN mkdir -p /var/log/supervisor && chmod -R 777 /var/log/supervisor
|
12 |
RUN mkdir -p /var/run/supervisor && chmod 777 /var/run/supervisor
|
|
|
13 |
|
14 |
# Install supervisord and python (for gradio)
|
15 |
RUN apt-get update && apt-get install -y supervisor python3 python3-pip git && rm -rf /var/lib/apt/lists/*
|
16 |
RUN pip3 install gradio
|
17 |
RUN pip3 install git+https://github.com/titipata/scipdf_parser
|
|
|
18 |
|
19 |
# Copy your gradio app to the image
|
20 |
COPY . /app/
|
@@ -29,7 +31,6 @@ RUN python3 -m spacy download en_core_web_sm
|
|
29 |
# Supervisord configuration
|
30 |
RUN echo "[supervisord]" > /etc/supervisor/conf.d/supervisord.conf && \
|
31 |
echo "nodaemon=true" >> /etc/supervisor/conf.d/supervisord.conf && \
|
32 |
-
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
33 |
echo "[rpcinterface:supervisor]" >> /etc/supervisor/conf.d/supervisord.conf && \
|
34 |
echo "supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface" >> /etc/supervisor/conf.d/supervisord.conf && \
|
35 |
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
@@ -40,7 +41,19 @@ RUN echo "[supervisord]" > /etc/supervisor/conf.d/supervisord.conf && \
|
|
40 |
echo "command=/opt/grobid/grobid-service/bin/grobid-service" >> /etc/supervisor/conf.d/supervisord.conf && \
|
41 |
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
42 |
echo "[program:gradio]" >> /etc/supervisor/conf.d/supervisord.conf && \
|
43 |
-
echo "command=python3 /app/main.py" >> /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Start processes with supervisord
|
46 |
-
CMD ["/usr/bin/supervisord"]
|
|
|
7 |
# Create necessary directories for Grobid
|
8 |
RUN mkdir -m 777 -p /opt/grobid/grobid-home/tmp
|
9 |
|
10 |
+
# Give permissions to the default supervisord log directory and Gradio logs
|
11 |
RUN mkdir -p /var/log/supervisor && chmod -R 777 /var/log/supervisor
|
12 |
RUN mkdir -p /var/run/supervisor && chmod 777 /var/run/supervisor
|
13 |
+
RUN mkdir -p /var/log/gradio && chmod 777 /var/log/gradio
|
14 |
|
15 |
# Install supervisord and python (for gradio)
|
16 |
RUN apt-get update && apt-get install -y supervisor python3 python3-pip git && rm -rf /var/lib/apt/lists/*
|
17 |
RUN pip3 install gradio
|
18 |
RUN pip3 install git+https://github.com/titipata/scipdf_parser
|
19 |
+
RUN pip3 install git+https://github.com/coderanger/supervisor-stdout
|
20 |
|
21 |
# Copy your gradio app to the image
|
22 |
COPY . /app/
|
|
|
31 |
# Supervisord configuration
|
32 |
RUN echo "[supervisord]" > /etc/supervisor/conf.d/supervisord.conf && \
|
33 |
echo "nodaemon=true" >> /etc/supervisor/conf.d/supervisord.conf && \
|
|
|
34 |
echo "[rpcinterface:supervisor]" >> /etc/supervisor/conf.d/supervisord.conf && \
|
35 |
echo "supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface" >> /etc/supervisor/conf.d/supervisord.conf && \
|
36 |
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
|
|
41 |
echo "command=/opt/grobid/grobid-service/bin/grobid-service" >> /etc/supervisor/conf.d/supervisord.conf && \
|
42 |
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
43 |
echo "[program:gradio]" >> /etc/supervisor/conf.d/supervisord.conf && \
|
44 |
+
echo "command=python3 /app/main.py" >> /etc/supervisor/conf.d/supervisord.conf && \
|
45 |
+
echo "stdout_logfile=/dev/fd/1" >> /etc/supervisor/conf.d/supervisord.conf && \
|
46 |
+
echo "stdout_logfile_maxbytes=0" >> /etc/supervisor/conf.d/supervisord.conf && \
|
47 |
+
echo "redirect_stderr=true" >> /etc/supervisor/conf.d/supervisord.conf && \
|
48 |
+
echo "stdout_events_enabled=true" >> /etc/supervisor/conf.d/supervisord.conf && \
|
49 |
+
echo "stderr_events_enabled=true" >> /etc/supervisor/conf.d/supervisord.conf && \
|
50 |
+
echo "" >> /etc/supervisor/conf.d/supervisord.conf && \
|
51 |
+
echo "[eventlistener:stdout]" >> /etc/supervisor/conf.d/supervisord.conf && \
|
52 |
+
echo "command = supervisor_stdout" >> /etc/supervisor/conf.d/supervisord.conf && \
|
53 |
+
echo "buffer_size = 100" >> /etc/supervisor/conf.d/supervisord.conf && \
|
54 |
+
echo "events = PROCESS_LOG" >> /etc/supervisor/conf.d/supervisord.conf && \
|
55 |
+
echo "result_handler = supervisor_stdout:event_handler" >> /etc/supervisor/conf.d/supervisord.conf
|
56 |
+
|
57 |
|
58 |
# Start processes with supervisord
|
59 |
+
CMD ["/usr/bin/supervisord"]
|