From 314abe4cc6c4240fbe331318911f0aa16696f144 Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Sun, 28 Jul 2024 19:54:07 +0200 Subject: [PATCH] Add node and exif & update entrypoint --- .dev/php/Dockerfile | 10 ++++++++-- .dev/php/entrypoint.sh | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.dev/php/Dockerfile b/.dev/php/Dockerfile index fa2ea445..5b945b76 100644 --- a/.dev/php/Dockerfile +++ b/.dev/php/Dockerfile @@ -14,8 +14,10 @@ RUN addgroup --gid ${GID} --system invoiceshelf && \ sed -i "s/user = www-data/user = invoiceshelf/g" /usr/local/etc/php-fpm.d/www.conf && \ sed -i "s/group = www-data/group = invoiceshelf/g" /usr/local/etc/php-fpm.d/www.conf -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +# Install composer & npm +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ + curl -sL https://deb.nodesource.com/setup_20.x | bash - && \ + apt install -y nodejs # install dependencies RUN apt update && apt install -y \ @@ -43,6 +45,7 @@ RUN apt update && apt install -y \ && docker-php-ext-install pdo_pgsql \ && docker-php-ext-install zip \ && docker-php-ext-install xml \ + && docker-php-ext-install exif \ && docker-php-source delete # Clear cache @@ -55,6 +58,9 @@ WORKDIR /home/invoiceshelf/app COPY /php/entrypoint.sh / # Entrypoint +USER invoiceshelf ENTRYPOINT ["/entrypoint.sh"] +# Launch php-fpm +USER root CMD ["php-fpm"] diff --git a/.dev/php/entrypoint.sh b/.dev/php/entrypoint.sh index 23e59fc1..f5974c1e 100755 --- a/.dev/php/entrypoint.sh +++ b/.dev/php/entrypoint.sh @@ -4,9 +4,30 @@ echo "############################################" echo "### InvoiceShelf Development Environment ###" echo "############################################" -chown -R ${UID}:${GID} /home/invoiceshelf/app -chmod +x /home/invoiceshelf/app/artisan +cd /home/invoiceshelf/app -cd /home/invoiceshelf/app && php artisan storage:link +chmod 775 storage/framework +chmod 775 storage/logs +chmod 775 bootstrap/cache + +chown -R ${UID}:${GID} /home/invoiceshelf/app + +chmod +x artisan + +if [ ! -d vendor ]; then + composer install +fi + +if [ ! -f .env ]; then + cp .env.example .env + php artisan key:generate --force +fi + +if [ ! -d node_modules ]; then + npm install + npm run build +fi + +php artisan storage:link exec $@