- Notifications
You must be signed in to change notification settings - Fork61
Docker environment required to run Laravel (based on official php and mysql docker hub repositories)
License
systemsdk/docker-apache-php-laravel
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Docker environment required to run Laravel (based on official php and mysql docker hub repositories).
- Docker Engine version 23.0 or later
- Docker Compose version 2.0 or later
- An editor or IDE
- MySQL Workbench
Note: OS recommendation - Linux Ubuntu based.
- Apache 2.4
- PHP 8.4 (Apache handler)
- MySQL 8
- Laravel 12
- Mailpit (only for debug emails on dev environment)
For installing Docker Engine with docker compose please follow steps mentioned on pageDocker Engine.
Note 1: Please run next cmd after above step if you are using Linux OS:sudo usermod -aG docker $USER
Note 2: If you are using Docker Desktop for MacOS 12.2 or later - please enablevirtiofs for performance (enabled by default since Docker Desktop v4.22).
1.You can clone this repository from GitHub or install via composer.
Note: Deletestorage/mysql-data
folder if it is exists.
If you have installed composer and want to install environment via composer you can use next cmd command:
composer create-project systemsdk/docker-apache-php-laravel example-app
2.Add domain to localhosts
file:
127.0.0.1 localhost
3.Configure/docker/dev/xdebug-main.ini
(Linux/Windows) or/docker/dev/xdebug-osx.ini
(MacOS) (optional):
- In case you need debug only requests with IDE KEY: PHPSTORM from frontend in your browser:
xdebug.start_with_request = no
Install locally in Firefox extension "Xdebug helper" and set in settings IDE KEY: PHPSTORM
- In case you need debug any request to an api (by default):
xdebug.start_with_request = yes
4.Build, start and install the docker images from your terminal:
make buildmake startmake composer-installmake env-dev
Note 1: If you want to change default docker configurations (web_port, etc...) - open.env
file, edit necessary environment variable value and stop, rebuild, start docker containers.
Note 2: If you are changing.env
file and such env params likeMYSQL_VERSION
,MYSQL_ROOT_PASSWORD
, don't forget to stop docker containers and deletestorage/mysql-data
folder before rebuild docker images.
5.Make sure that you have installed migrations/seeds:
make migratemake seed
6.Set key for application:
make key-generate
7.In order to use this application, please open in your browser next urls:
1.You can clone this repository from GitHub or install via composer.
Note: Deletestorage/mysql-data
andvendor
folder if it is exists.
If you have installed composer and want to install environment via composer you can use next cmd command:
composer create-project systemsdk/docker-apache-php-laravel example-app
Note: If you want to change default docker configurations (web_port, etc...) - create uncommitted.env
file, copy data from.env.staging
, edit necessary environment variable value.
2.Build, start and install the docker images from your terminal:
make build-stagingmake start-staging
3.Make sure that you have installed migrations:
make migrate-no-test
4.Set key for application:
make key-generate
1.You can clone this repository from GitHub or install via composer.
Note: Deletestorage/mysql-data
andvendor
folder if it is exists.
If you have installed composer and want to install environment via composer you can use next cmd command:
composer create-project systemsdk/docker-apache-php-laravel example-app
2.Editcompose-prod.yaml
and set necessary user/password for MySQL.
3.Editenv.prod
and set necessary user/password for MySQL.
Note: If you want to change default docker configurations (web_port, etc...) - create uncommitted.env
file, copy data from.env.prod
, edit necessary environment variable value.
4.Build, start and install the docker images from your terminal:
make build-prodmake start-prod
5.Make sure that you have installed migrations:
make migrate-no-test
6.Set key for application:
make key-generate
After application will start (make start
) and in order to get shell access inside laravel container you can run following command:
make ssh
Note 1: Please use next make commands in order to enter in other containers:make ssh-nginx
,make ssh-supervisord
,make ssh-mysql
.
Note 2: Please useexit
command in order to return from container's shell to local shell.
In case you edited Dockerfile or other environment configuration you'll need to build containers again using next commands:
make downmake buildmake start
Note: Please use environment-specific commands if you need to build test/staging/prod environment, more details can be found using helpmake help
.
Please use next make commands in order to start and stop environment:
make startmake stop
Note 1: For staging environment need to be used next make commands:make start-staging
,make stop-staging
.
Note 2: For prod environment need to be used next make commands:make start-prod
,make stop-prod
.
Please use next make commands in order to stop and remove environment containers, networks:
make down
Note: Please use environment-specific commands if you need to stop and remove test/staging/prod environment, more details can be found using helpmake help
.
make buildmake build-testmake build-stagingmake build-prodmake startmake start-testmake start-stagingmake start-prodmake stopmake stop-testmake stop-stagingmake stop-prodmake downmake down-testmake down-stagingmake down-prodmake restartmake restart-testmake restart-stagingmake restart-prodmake env-devmake env-test-cimake sshmake ssh-rootmake fishmake ssh-supervisordmake ssh-mysqlmake composer-install-no-devmake composer-installmake composer-updatemake composer-auditmake key-generatemake infomakehelpmake logsmake logs-supervisordmake logs-mysqlmake drop-migratemake migrate-no-testmake migratemake seedmake phpunitmake report-code-coveragemake phpcsmake ecsmake ecs-fixmake phpmetricsmake phpcpdmake phpcpd-html-reportmake phpmdmake phpstanmake phpinsightsetc....
Notes: Please see more commands in Makefile
- Laravel
- phpunit
- laravel-ide-helper
- scriptsdev
- composer-bin-plugin
- ergebnis/composer-normalize
- composer-unused
- composer-require-checker
- security-advisories
- php-coveralls
- easy-coding-standard
- PhpMetrics
- phpcpd
- phpmd
- phpstan
- phpinsights
- rector
- For new feature development, fork
develop
branch into a new branch with one of the two patterns:feature/{ticketNo}
- Commit often, and write descriptive commit messages, so it's easier to follow steps taken when reviewing.
- Push this branch to the repo and create pull request into
develop
to get feedback, with the formatfeature/{ticketNo}
- "Short descriptive title of Jira task". - Iterate as needed.
- Make sure that "All checks have passed" on CircleCI(or another one in case you are not using CircleCI) and status is green.
- When PR is approved, it will be squashed & merged, into
develop
and later merged intorelease/{No}
for deployment.
Note: You can find git flow detail examplehere.
About
Docker environment required to run Laravel (based on official php and mysql docker hub repositories)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.