diff --git a/Dockerfile b/Dockerfile index e25f001..532090b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,6 @@ WORKDIR /var/www # Copy project files COPY . . -COPY .env.example .env # Install Laravel dependencies RUN composer install --no-interaction --prefer-dist --optimize-autoloader @@ -39,5 +38,11 @@ RUN chown -R www-data:www-data /var/www \ && chmod -R 775 storage bootstrap/cache \ && chown -R www-data:www-data storage bootstrap/cache + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh EXPOSE 9000 -CMD ["php-fpm"] + +ENTRYPOINT ["/entrypoint.sh"] + + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..b5dedb2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Salin .env jika belum ada +if [ ! -f .env ]; then + cp .env.example .env +fi + +# Set ownership dan permission untuk Laravel +chown -R www-data:www-data /var/www +chmod -R 775 /var/www/storage /var/www/bootstrap/cache +chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache + +# Jalankan php-fpm +exec php-fpm