diff --git a/Dockerfile b/Dockerfile index c90bfed..989b453 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,12 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local WORKDIR /var/www/html -COPY ./laravel . +COPY ./laravel/composer.* ./ RUN composer install --no-scripts --no-interaction +COPY ./laravel . + RUN chown -R www-data:www-data /var/www/html RUN chmod -R 775 /var/www/html/storage diff --git a/docker-compose.yml b/docker-compose.yml index 3faf209..8cd194d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,7 @@ services: condition: service_healthy volumes: - ./laravel:/var/www/html + - /var/www/html/vendor environment: - DB_HOST=mysql - DB_PORT=3306 diff --git a/entrypoint.sh b/entrypoint.sh index fd6c4f3..ae6dd4e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,13 @@ #!/bin/bash set -e + +# Create .env if missing +if [ ! -f /var/www/html/.env ]; then + cp /var/www/html/.env.example /var/www/html/.env + php artisan key:generate +fi + # Fix ownership and permissions chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache