https://github.com/jva91/docker-laravel-mix
Laravel mix container for docker
https://github.com/jva91/docker-laravel-mix
docker laravel laravel55 nodejs nodejs-docker
Last synced: 11 months ago
JSON representation
Laravel mix container for docker
- Host: GitHub
- URL: https://github.com/jva91/docker-laravel-mix
- Owner: jva91
- Created: 2019-08-16T06:01:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-16T07:10:25.000Z (almost 7 years ago)
- Last Synced: 2025-04-08T07:51:30.389Z (about 1 year ago)
- Topics: docker, laravel, laravel55, nodejs, nodejs-docker
- Language: Dockerfile
- Size: 33.2 KB
- Stars: 14
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-laravel-mix
This setup contains a docker installation tested for Laravel 5.5 + Laravel mix.
## Containers
- app container
- mysql container
- phpmyadmin container
- node container
Node container is running in the background to poll the css and js files.
## Usage
To start this setup use `docker-compose up -d`, this starts all the containers. For Linux and Mac be sure the files in docker/init-scripts have rights to execute.
These rights need to be set on the host (so not on the docker server), and can be done by executing `chmod -R 0777 docker/init-scripts` in the root of your project
The app and node container contains a entrypoint, this calls an bash script to startup the container.
This will allow us to override the standard execution of the docker image and adding composer and laravel mix actions.
apache_start.sh
#!/bin/sh
set -e
echo 'running prestart apache script'
echo 'running composer install'
composer install
php artisan migrate
echo 'initialization done, starting apache'
exec apache2-foreground
On startup `composer install`, `php artisan migrate` and `apache2-foreground`(starts apache service) are executed when calling `docker-compose up`.
node_start.sh
#!/bin/sh
set -e
echo 'running prestart node script'
echo 'running npm install'
npm install
echo 'initialization done, start watching'
npm run watch-poll
When the node image is started `npm install` is executed, after that `npm run watch-poll` is called to continuously run Laravel Mix in the background of the node image.
We are using `npm run watch-poll` because of problems with `npm run watch` not detecting file changes, but you are free to change this offcourse.