-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathdocker-entrypoint.sh
37 lines (30 loc) · 1.23 KB
/
docker-entrypoint.sh
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
#!/bin/bash
set -eou pipefail
USE_GEN="${USE_GENERATE:=true}"
# requirements are installed at runtime instead of during image build
# so that image isn't 6GB+ due to nvidia/torch package sizes
#
# will cause first run to take a long time but subsequent container starts will be fast
if python -m pip show -q py-cord ; then
printf '****************\nChecking requirements\n****************\n'
else
printf '****************\nInstalling requirements, this may take some time!\n****************\n'
fi
if [ "$USE_GEN" = "true" ]; then
pip install -r requirements.txt
else
# don't use full requirements if user explicitly disabled /generate command
pip install -r requirements_no_generate.txt
fi
printf '****************\nRequirements satisfied!\n****************\n'
# Copy the default resource and outputs files if they don't exist.
cp -n "/default/resources/messages.csv" "/app/resources/messages.csv"
cp -n "/default/outputs/.keep" "/app/outputs/.keep"
if [ "$USE_GEN" = "true" ]; then
printf '****************\nChecking for required /generate files/models\n****************\n'
# Download generate pre-reqs
python core/setup_generate.py
fi
printf '****************\nStarting Aiyabot\n****************\n'
# Start the app.
python aiya.py