forked from gitcoinco/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-command.bash
More file actions
executable file
·83 lines (66 loc) · 2.57 KB
/
docker-command.bash
File metadata and controls
executable file
·83 lines (66 loc) · 2.57 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/local/bin/dumb-init /bin/bash
# Load the .env file into the environment.
if [ "$ENV" == 'staging' ]; then
# shellcheck disable=SC2046
export $(grep -v '^#' app/app/.env | xargs)
fi
# Settings
# Web
GC_WEB_WORKER=${GC_WEB_WORKER_TYPE:-runserver_plus}
# General / Overrides
FORCE_PROVISION=${FORCE_PROVISION:-'off'}
FORCE_GET_PRICES=${FORCE_GET_PRICES:-'off'}
cd app || exit 1
# Check whether or not the .env file exists. If not, create it.
if [ ! -f app/.env ]; then
cp app/local.env app/.env
fi
# Enable Python dependency installation on container start/restart.
if [ ! -z "${INSTALL_REQS}" ]; then
echo "Installing Python packages..."
pip3 install -r ../requirements/test.txt
echo "Python package installation completed!"
fi
GC_WEB_OPTS="${GC_WEB_WORKER} ${GC_WEB_INTERFACE:-0.0.0.0}:${GC_WEB_PORT:-8000}"
if [ "$VSCODE_DEBUGGER_ENABLED" = "on" ]; then
pip3 install ptvsd
GC_WEB_OPTS="${GC_WEB_OPTS} --nothreading"
echo "VSCode remote debugger enabled! This has disabled threading!"
fi
if [ "$GC_WEB_WORKER" = "runserver_plus" ]; then
GC_WEB_OPTS="${GC_WEB_OPTS} --extra-file /code/app/app/.env --nopin --verbosity 0"
fi
# Provision the Django test environment.
if [ ! -f /provisioned ] || [ "$FORCE_PROVISION" = "on" ]; then
echo "First run - Provisioning the local development environment..."
if [ "$DISABLE_INITIAL_CACHETABLE" != "on" ]; then
python3 manage.py createcachetable
fi
if [ "$DISABLE_INITIAL_COLLECTSTATIC" != "on" ]; then
python3 manage.py collectstatic --noinput -i other &
fi
if [ "$DISABLE_INITIAL_MIGRATE" != "on" ]; then
python3 manage.py migrate
fi
if [ "$DISABLE_INITIAL_LOADDATA" != "on" ]; then
python3 manage.py loaddata app/fixtures/oauth_application.json
python3 manage.py loaddata app/fixtures/users.json
python3 manage.py loaddata app/fixtures/economy.json
python3 manage.py loaddata app/fixtures/profiles.json
python3 manage.py loaddata app/fixtures/kudos.json
python3 manage.py loaddata app/fixtures/grants.json
python3 manage.py loaddata app/fixtures/dashboard.json
python3 manage.py loaddata app/fixtures/avatar.json
python3 manage.py loaddata app/fixtures/marketing.json
fi
date >> /provisioned
echo "Provisioning completed!"
fi
if [ "$FORCE_GET_PRICES" = "on" ]; then
python3 manage.py get_prices
fi
if [ "$KUDOS_LOCAL_SYNC" = "on" ]; then
bash /code/scripts/sync_kudos_listener_local.bash &
bash /code/scripts/sync_kudos_local.bash &
fi
exec python3 manage.py $GC_WEB_OPTS