Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ EXPOSE 8000:80

# Start Apache
CMD ["apache2-foreground"]
# Copy the entrypoint script into the image
COPY docker-entrypoint.sh /var/www/html/docker-entrypoint.sh

# Make sure it is executable
RUN chmod +x /var/www/html/docker-entrypoint.sh

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- ./:/var/www/html
- /var/www/html/node_modules
- /var/www/html/vendor
entrypoint: ["/var/www/html/docker-entrypoint.sh"] # <-- this is the only line you add
depends_on:
- db
networks:
Expand Down
20 changes: 20 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

echo "Waiting for the database..."
until nc -z db 3306; do
sleep 1
done
echo "Database is up."

composer install --no-interaction
npm install

php artisan key:generate
php artisan migrate --force
php artisan db:seed --force
php artisan storage:link
composer dump-autoload

exec npm run dev