File tree Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ node_modules/
10
10
selenium_server_deploy.jar
11
11
# assets directory
12
12
assets
13
+ .vscode
13
14
14
15
# Ignoring generated files during the build process
15
16
StandaloneC * /selenium.conf
Original file line number Diff line number Diff line change @@ -17,16 +17,19 @@ ENV DEBIAN_FRONTEND=noninteractive \
17
17
# ========================
18
18
RUN apt-get -qqy update \
19
19
&& apt-get -qqy --no-install-recommends install \
20
- supervisor x11-xserver-utils \
20
+ supervisor x11-xserver-utils python3-pip \
21
21
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
22
22
23
23
# ======================================
24
- # Add Supervisor configuration file
24
+ # Add Supervisor configuration files
25
25
# ======================================
26
26
COPY supervisord.conf /etc
27
- COPY entry_point.sh video.sh /opt/bin/
27
+ COPY entry_point.sh video.sh video_ready.py /opt/bin/
28
+ RUN cd /opt/bin && pip install psutil
28
29
29
30
RUN mkdir -p /var/run/supervisor /var/log/supervisor /videos
30
31
31
32
ENTRYPOINT ["/opt/bin/entry_point.sh" ]
32
33
CMD ["/opt/bin/entry_point.sh" ]
34
+
35
+ EXPOSE 9000
Original file line number Diff line number Diff line change @@ -25,3 +25,16 @@ redirect_stderr=true
25
25
stdout_logfile=/dev/stdout
26
26
stdout_logfile_maxbytes=0
27
27
28
+ [program:video-ready]
29
+ priority=5
30
+ command=python3 /opt/bin/video_ready.py
31
+ autostart=true
32
+ autorestart=false
33
+ startsecs=0
34
+ startretries=0
35
+ stopsignal=INT
36
+
37
+ ;Logs (all activity redirected to stdout so it can be seen through "docker logs"
38
+ redirect_stderr=true
39
+ stdout_logfile=/dev/stdout
40
+ stdout_logfile_maxbytes=0
Original file line number Diff line number Diff line change
1
+ from http .server import BaseHTTPRequestHandler ,HTTPServer
2
+ from os import environ
3
+ import json
4
+ import psutil
5
+
6
+ video_ready_port = environ .get ('VIDEO_READY_PORT' , 9000 )
7
+
8
+ class Handler (BaseHTTPRequestHandler ):
9
+
10
+ def do_GET (self ):
11
+ video_ready = "ffmpeg" in (p .name ().lower () for p in psutil .process_iter ())
12
+ response_code = 200 if video_ready else 404
13
+ response_text = "ready" if video_ready else "not ready"
14
+ self .send_response (response_code )
15
+ self .end_headers ()
16
+ self .wfile .write (json .dumps ({'status' : response_text }).encode ('utf-8' ))
17
+
18
+ httpd = HTTPServer ( ('0.0.0.0' , video_ready_port ), Handler )
19
+ httpd .serve_forever ()
You can’t perform that action at this time.
0 commit comments