PHP Docker template for new project PHP-FPM + PHP-CLI + NGINX
All you need to do, is install the Docker
#STEP BY STEP for create new project:
- Install Docker
https://www.docker.com/get-started
- Install Git
https://git-scm.com/downloads
- Clone this repository $
git clone https://github.com/binarick/php-skeleton
- (dont need) if you wont you can recreate 'composer.json' $
docker-compose run --rm php-cli composer init
- Star initialisation $
make first-run
(composer install) - Start project $
make up
Done !!! You project ready for work
#That you will get:
- php:7.4-fpm + xdebug
- php:7.4-cli + composer
- nginx:alpine latest version
- Build for Production and Development
- Composer install on CLI only (FPM clear)
- Composer remove from production images
- Multistage build (super fast build for production)
- Small production image (only code, no composer)
- Mount you local SRC folder in FPM and CLI
- Developer dependencies will not be included in the image
- Optimise autoloader for production
- PHP-Opcache install for production
- dockerignore and gitignore files
- 'make up' - start project
- 'make init' - project initialization (for first run or rebuild)
- 'make env-init' - local data initialization (composer local install)
- 'make build-prod' - build production
- 'make push-prod' - push production
- 'make deploy-prod' - deploy production
Examples
Production build: REGISTRY_ADDRESS=registry IMAGE_TAG=0 make build-prod