-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·61 lines (56 loc) · 1.64 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·61 lines (56 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# Socialhome Docker Development entrypoint
# Exit immediately if a command exits with a non-zero status.
set -e
[[ -z "${CODE_DIR}" ]] && CODE_DIR="/data/prd/djpmp"
cd $CODE_DIR
# Define help message
show_help() {
echo """
Usage: docker run <imagename> COMMAND
Commands
runserver : Run Django development server
bash : Start a bash shell
manage : Run a Django management command
python : Run a python command
shell : Start a Django Python shell
celery : Start celery worker
help : Show this message
"""
}
# Run
case "$1" in
runserver)
echo "Running Development Server..."
pip3 install -r requirements-docker.txt
python3 src/manage.py migrate || (echo "migrate return: "$?; python3 cli.py fail; exit 1)
python3 src/manage.py loaddata --format yaml fixtures.yaml || (echo "load data return: "$?; python3 cli.py fail; exit 1)
python3 src/manage.py collectstatic --noinput || (echo "collectstatic return: "$?; python3 cli.py fail; exit 1)
python3 cli.py ok
PYTHONPATH=./src gunicorn -c src/gunicorn.conf.py -p gunicorn-djpmp.pid config.wsgi
;;
bash)
/bin/bash "${@:2}"
;;
manage)
pwd
echo "Running manage:" "${@:2}"
python3 src/manage.py "${@:2}"
;;
python)
echo "Running python command..." "${@:2}"
python3 "${@:2}"
;;
shell)
echo "Running shell_plus..."
python3 src/manage.py shell_plus
;;
celery)
echo "Running celery tasks..."
cd src && celery -A config worker -l info
;;
*)
show_help
;;
esac