File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,12 @@ RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cac
35
35
# Install PHP dependencies
36
36
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
37
37
38
+ # Copy the entrypoint script
39
+ COPY docker-entrypoint.sh /usr/local/bin/
40
+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
41
+
38
42
# Expose port 80
39
43
EXPOSE 80
40
44
41
- # Start Apache
42
- CMD ["apache2-foreground " ]
45
+ # Set entrypoint
46
+ ENTRYPOINT ["docker-entrypoint.sh " ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -e
3
+
4
+ # Wait for the database to be ready before running migrations
5
+ echo " Waiting for database connection..."
6
+ until php artisan migrate --force; do
7
+ echo " Migration failed, retrying in 5 seconds..."
8
+ sleep 5
9
+ done
10
+
11
+ # Start Apache
12
+ exec apache2-foreground
You can’t perform that action at this time.
0 commit comments