Added dockerfile

Issue #5
Close #5
This commit is contained in:
laucyun
2022-04-20 21:30:15 +08:00
parent da7d13612c
commit 9344cb1205
6 changed files with 180 additions and 28 deletions
+26
View File
@@ -0,0 +1,26 @@
#! /usr/bin/env sh
set -e
python /dnslog/manage.py makemigrations logview
python /dnslog/manage.py migrate
python /dnslog/manage.py collectstatic --noinput
# Run nginx
nginx_count=`ps aux|grep nginx|grep -v grep|wc -l`
if [ $nginx_count -eq 0 ]; then
nginx -g 'daemon off;' &
fi
# Run zoneresolver.py
zoneresolver_count=`ps aux|grep zoneresolver|grep -v grep|wc -l`
if [ $zoneresolver_count -eq 0 ]; then
python /dnslog/zoneresolver.py &
fi
# Run gunicorn
gunicorn_count=`ps aux|grep gunicorn|grep -v grep|wc -l`
if [ $gunicorn_count -eq 0 ]; then
gunicorn --workers 5 --bind 0.0.0.0:8000 dnslog.wsgi:application --daemon
fi
exec "$@"