-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
39 lines (31 loc) · 939 Bytes
/
entrypoint.sh
File metadata and controls
39 lines (31 loc) · 939 Bytes
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
#!/bin/bash
# Exit on error
set -e
# print the value of CALCULATED_EDGES_PATH
echo "CALCULATED_EDGES_PATH: $CALCULATED_EDGES_PATH"
# check if the CALCULATED_EDGES_PATH is a file
if [ -f "$CALCULATED_EDGES_PATH" ]; then
echo "Scores already calculated. Skipping."
else
echo "Calculating scores..."
# Run the script to calculate the edges
python manage.py compute_association_scores
fi
# Initialize the database
python manage.py initialise_db
# Run migrations
python manage.py makemigrations
python manage.py migrate
# Create a superuser if it doesn’t exist
python manage.py shell <<EOF
from django.contrib.auth import get_user_model
import os
User = get_user_model()
if not User.objects.filter(username=os.getenv("ADMIN_USER")).exists():
User.objects.create_superuser(
username=os.getenv("ADMIN_USER"),
password=os.getenv("ADMIN_PASS")
)
EOF
# Execute the CMD from the Dockerfile
exec "$@"