A mixerapi/mixerapi application template for Docker Compose and Kubernetes based on the official cakephp/app 4.4 template.
This project has been forked from cnizzardini/cakephp-docker.
- Docker 20 or higher
- Make
Service | Host:Port | Docker Host | Image |
---|---|---|---|
PHP8.1-FPM w/ Xdebug 3 | - | php | cnizzardini/php-fpm-alpine:8.1-latest |
NGINX 1.19 | localhost:8080 | web | nginx:1.19-alpine |
MySQL 8 | localhost:3607 | db | library/mysql:8 |
Fork and clone this repository then run:
make init
That's it! Now just remove app/*
from .gitignore. You may also want to remove
.assets and adjust defaults in .github, .docker, and .kube.
Note:
make init
andmake init.nocache
output interactively, whilemake start
andmake up
do not.
-
Change your
SHELL
in the Makefile to/bin/zsh
. This improves various output from the Makefile such as emoji's. -
Mac ships with an older version of
sed
so installgnu-sed
for some targets in the Makefile:
brew install gnu-sed
Then update sed
to gsed
in the Makefile.
After install browse to http://localhost:8080 to see the CakePHP welcome page.
A Makefile is provided with some optional commands for your convenience. Please review the Makefile as these commands are not exact aliases of docker-compose commands.
Make Command | Description |
---|---|
make |
Shows all make target commands |
make init |
Runs docker build, docker-compose up, and copies over env files |
make init.nocache |
Same as make.init but builds with --no-cache |
make start |
Starts services docker-compose -f .docker/docker-compose.yml start |
make stop |
Stops services docker-compose -f .docker/docker-compose.yml stop |
make up |
Create and start containers docker-compose -f .docker/docker-compose.yml up -d |
make down |
Take down and remove all containers docker-compose -f .docker/docker-compose.yml down |
make restart |
Restarts services docker-compose -f .docker/docker-compose.yml restart |
make php.sh |
PHP terminal docker exec -it --user cakephp <PHP_CONTAINER> sh |
make php.restart |
Restarts the PHP container |
make db.sh |
DB terminal docker exec -it <DB_CONTAINER> sh |
make db.mysql |
MySQL terminal mysql -u root -h 0.0.0.0 -p --port 3307 |
make web.sh |
Web terminal docker exec -it <WEB_CONTAINER> sh |
make xdebug.on |
Restarts PHP container with xdebug.mode set to debug,coverage |
make xdebug.off |
Restarts PHP container with xdebug.mode set to off |
make composer.install |
docker exec <PHP_CONTAINER> composer install --no-interaction |
make composer.test |
docker exec <PHP_CONTAINER> composer test |
make composer.check |
docker exec <PHP_CONTAINER> composer check |
See .docker/README.md for details.
Shell:
make php.sh
Helper commands:
make composer.install
make composer.test
make composer.check
See .docker/README.md for details.
Shell:
make db.sh
MySQL shell (requires mysql client on your localhost):
make db.mysql
See .docker/README.md for details.
Shell:
make web.sh
Xdebug is disabled by default. To toggle:
make xdebug.on
make xdebug.off
Xdebug 3's default port is 9003
.
Go to File > Settings > Languages & Frameworks > PHP > Servers
- Name:
localhost
- Host:
localhost
- Port:
8080
- Debugger:
Xdebug
- Use path mappings:
Enable
Map your project's app directory to the absolute path on the docker container /srv/app
To completely reinstall delete existing containers and images, then remove the app/
directory and run make init
again.