- NGINX (latest)
- MONGO (latest)
- MYSQL (latest)
- REDIS (latest)
- PHP8.4-FPM-ALPINE (latest)
- Obtenha o projeto
git clone https://github.com/admsilva/docker-laravel-app.git
cd docker-laravel-app
cp .env-example .env
docker-compose up -d --build
- Se quiser você pode alterar as variáveis de ambiente no arquivo .env:
APP_ENV=dev
UID=1000
USER_NAME=www
GID=1000
GROUP_NAME=www
NGINX_PORT=8181
MYSQL_PORT=3308
APP_FOLDER=./src
LOG_FOLDER=./log
DOCKER_FILE_FOLDER=./docker
MYSQL_ROOT_PASSWORD=secret
MYSQL_DATABASE=local_database
MYSQL_USER=user_database
MYSQL_PASSWORD=secret
MYSQL_SERVICE_TAGS=dev
MYSQL_SERVICE_NAME=mysql
REDIS_PORT=6379
REDIS_PASSWORD=redis-password
MONGO_USER=user
MONGO_ROOT_PASSWORD=secret
MONGO_DATABASE=local_database
MONGO_PORT=27017
- Iniciando um projeto/lib com composer
docker-compose run --rm php.dev composer init
- Rodar composer install no projeto
docker-compose run --rm php.dev composer install
- Rodar composer update no projeto
docker-compose run --rm php.dev composer update
- A aplicação
http://localhost:8181
Host: localhost
Port: 27017
User: user
Password: secret
Host: localhost
Port: 3306
User: homestead
Password: secret
Host: localhost
Port: 6379
Password: redis-password
./
├──┐
│ │
│ ├─ docker
| | |
│ │ └─ mongo
| | | |
| | | └─ Dockerfile
| | |
│ │ └─ mysql
| | | |
| | | └─ Dockerfile
| | |
│ │ └─ nginx
| | | |
| | | └─ config
| | | | |
| | | | └─ etc
| | | | |
| | | | └─ nginx
| | | | |
| | | | └─ config.d
| | | | | |
| | | | | └─ default.conf
| | | | |
| | | | └─ nginx.conf
| | | |
| | | └─ scripts
| | | | |
| | | | └─ docker-entrypoint.sh
| | | |
| | | └─ Dockerfile
| | |
│ │ └─ php
| | | |
| | | └─ config
| | | | |
| | | | └─ usr
| | | | |
| | | | └─ local
| | | | |
| | | | └─ etc
| | | | |
| | | | └─ php
| | | | | |
| | | | | └─ php.ini-development
| | | | | |
| | | | | └─ php.ini-production
| | | | |
| | | | └─ php-fpm.d
| | | | |
| | | | └─ www.conf
| | | |
| | | └─ scripts
| | | | |
| | | | └─ docker-entrypoint.sh
| | | |
| | | └─ Dockerfile
| | |
│ │ └─ redis
| | | |
| | | └─ Dockerfile
| | |
│ ├─ log
│ │ │
│ │ └─ access & error log
│ │
│ ├─ src
│ │ │
│ │ └─ Laravel app folder
│ │
- Parar todos os containers
docker kill $(docker ps -q)
- Remover todos os containers
docker rm $(docker ps -a -q)
- Remover todas as imagens
docker rmi $(docker images -q)
- CLI de acesso ao container
docker-compose exec <name|id> /bin/bash