I have this service in my docker-compose.yml
php-fpm: container_name: php_app restart: always build: context: . dockerfile: ./docker/php-fpm/Dockerfile volumes: - ./src:/var/www/html
that take everything of the host folder src
and add to /var/www/html
:
FROM php:8.0.2-fpm-alpine
WORKDIR /var/www/html
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mysqli
RUN apk add icu-dev
COPY docker/php-fpm/config/php.ini /usr/local/etc/php/
RUN apk add --update nodejs nodejs-npm
RUN npm install gulp-cli -g
RUN npm install
COPY src src/
CMD ["php-fpm"]
EXPOSE 9000
accessing the container using sudo docker exec -it php_app sh
and executing ls -la
I have:
drwxrwxr-x 6 1001 1001 4096 May 12 15:54 writable
which must be owned by www-data
, how can I set the ownership automatically when the builds complete?