From c46c5655b261f0789a2a1fb8ae4f1e391dfe05e1 Mon Sep 17 00:00:00 2001 From: sarahelsagheir <53413980+sarahelsagheir@users.noreply.github.com> Date: Fri, 8 Nov 2024 23:25:41 +0300 Subject: [PATCH] Add Permission Configurations to Dockerfile --- .docker/php/Dockerfile | 8 ++++++++ .docker/php/entrypoint.sh | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 .docker/php/entrypoint.sh diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile index 838a576..ecf6926 100644 --- a/.docker/php/Dockerfile +++ b/.docker/php/Dockerfile @@ -4,6 +4,10 @@ COPY php.ini /usr/local/etc/php/ COPY docker.conf /usr/local/etc/php-fpm.d/docker.conf COPY .bashrc /root/ +# Copy the entrypoint script +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + # mix RUN apt-get update \ && apt-get install -y build-essential zlib1g-dev default-mysql-client curl gnupg procps vim git unzip libzip-dev libpq-dev \ @@ -53,3 +57,7 @@ RUN git clone https://github.com/seebi/dircolors-solarized EXPOSE 5173 WORKDIR /var/www + +#entrypoint +ENTRYPOINT ["entrypoint.sh"] +CMD ["php-fpm"] \ No newline at end of file diff --git a/.docker/php/entrypoint.sh b/.docker/php/entrypoint.sh new file mode 100644 index 0000000..99b8f61 --- /dev/null +++ b/.docker/php/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +# Set permissions for Laravel directories +chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache +chmod -R 775 /var/www/storage /var/www/bootstrap/cache + +# permissions for PHPMyAdmin +mkdir -p /sessions + +chmod 777 /sessions + +exec "$@" \ No newline at end of file