Skip to content

Commit

Permalink
Add seeder, move listener to supervisord
Browse files Browse the repository at this point in the history
- No longer overrides base image's CMD
- Seeder checks for "OK" anywhere in the output of "php artisan db:monitor", retrying every 5 seconds, then runs the seeder once OK is seen
  • Loading branch information
Loki-101 authored Jan 2, 2025
1 parent d90b72b commit b014945
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,19 @@ RUN mkdir -p /blueprint_extensions /app
COPY .helpers/listen.sh /listen.sh
RUN chmod +x /listen.sh

# Set CMD to run the listen script in the background and start supervisord
CMD /listen.sh & exec supervisord -n -c /etc/supervisord.conf
# Append listener and seeder to supervisord
RUN echo "" >> /etc/supervisord.conf && \
cat >> /etc/supervisord.conf <<'EOF'
[program:database-seeder]
command=/bin/bash -c 'while ! [[ $(/usr/local/bin/php /app/artisan db:monitor) =~ OK ]]; do /bin/sleep 5; done && /usr/local/bin/php /app/artisan db:seed --class=BlueprintSeeder --force'
user=nginx
autostart=true
autorestart=false
startsecs=0

[program:listener]
command=/listen.sh
user=root
autostart=true
autorestart=true
EOF

0 comments on commit b014945

Please sign in to comment.