This package is a php-fpm image for php applications. You can call this image statically on your docker file and customize it according to your application needs.
Place the code below on top of your Dockerfile
FROM ghcr.io/vedatunlu/php-fpm-image:latest
Image has default configurations but you are free to use your own config files. Place your configuration files to your project. For example I placed my own configuration files inside "./deploy" folder and copy your configuration files to the container that will be created after running Dockerfile.
COPY ./deploy/php/php-fpm.ini /usr/local/etc/php/php-99.ini
COPY ./deploy/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./deploy/nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./deploy/nginx/default.conf /etc/nginx/conf.d/
COPY ./deploy/entrypoint.sh /entrypoint.sh
COPY --chown=www-data:www-data . .
RUN \
composer install --no-cache && composer dump-autoload -o && composer clear-cache \
\
yarn install && yarn prod && yarn cache clean --all \
\
&& chown -R www-data:www-data vendor/ composer.lock \
&& chmod -R 755 /var/www/storage && chmod -R 755 /var/www/bootstrap \
&& chmod +x /entrypoint.sh
You can create a sh script file and add it to the entrypoint of the container if you have any command that has to run after container created.
For example; create ./deploy/entrypoint.sh file to run necessary command and added it to at bottom of the Dockerfile
ENTRYPOINT [ "/entrypoint.sh" ]
You are free to use your own configuration files (nginx, php.ini etc.).
docker build -f ./Dockerfile -t [image-name] .
docker run -it -p 8000:80 [image-name]
The command above will create a container mapping the port number to 8000. You can now get response from http://localhost:8000
FROM ghcr.io/vedatunlu/php-fpm-image:latest
COPY ./deploy/php/php-fpm.ini /usr/local/etc/php/php-99.ini
COPY ./deploy/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./deploy/nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./deploy/nginx/default.conf /etc/nginx/conf.d/
COPY ./deploy/entrypoint.sh /entrypoint.sh
COPY --chown=www-data:www-data . .
RUN \
composer install --no-cache && composer dump-autoload -o && composer clear-cache \
\
yarn install && yarn prod && yarn cache clean --all \
\
&& chown -R www-data:www-data vendor/ composer.lock \
&& chmod -R 755 /var/www/storage && chmod -R 755 /var/www/bootstrap \
&& chmod +x /entrypoint.sh \
\
&& php artisan clear-compiled || : \
&& php artisan cache:clear || : \
&& php artisan config:clear || : \
&& php artisan event:clear || : \
&& php artisan optimize:clear || : \
&& php artisan route:clear || : \
&& php artisan view:clear || :
ENTRYPOINT [ "/entrypoint.sh" ]
We welcome and appreciate your contributions to the package! The contribution guide can be found here.
This package is open-sourced software licensed under the MIT license.