-
Notifications
You must be signed in to change notification settings - Fork 46
/
docker-entrypoint.sh
executable file
·54 lines (39 loc) · 1.41 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -e
role=${CONTAINER_ROLE:-app}
if [ "$role" = "launch-all-at-once" ]; then
echo "Running one item of every role";
set -m # make job control work
CONTAINER_ROLE=app ./docker-entrypoint.sh &
CONTAINER_ROLE=queue ./docker-entrypoint.sh &
CONTAINER_ROLE=scheduler ./docker-entrypoint.sh &
fg %1
else
wait-for-it "$DB_HOST:${DB_PORT:=3306}"
cd /var/www/html
runuser -u www-data -- php artisan optimize
if [ "$role" = "app" ]; then
echo "Running as app..."
if [ "${SEED_DB}" = "true" ]; then
echo "Resetting OAuth keys and seeding database"
runuser -u www-data -- php artisan migrate:fresh --seed --force
runuser -u www-data -- php artisan passport:install --force --quiet --no-interaction
else
runuser -u www-data -- php artisan migrate --force
fi
runuser -u www-data -- php artisan storage:link
apache2-foreground
elif [ "$role" = "queue" ]; then
echo "Running the queue..."
runuser -u www-data -- php artisan queue:work --queue=default,webhook
elif [ "$role" = "scheduler" ]; then
echo "Running as scheduler..."
while true; do
runuser -u www-data -- php artisan schedule:run --verbose --no-interaction
sleep 60
done
else
echo "Could not match the container role \"$role\""
exit 1
fi
fi