Skip to content

Commit

Permalink
Add docker-compose with readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ProtocolNebula authored and Ruben Arroyo committed Dec 19, 2024
1 parent 552a069 commit 8ca8ec7
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ docker run -e CONTAINER_MODE=worker -e WORKER_COMMAND="php /var/www/html/artisan
docker run --rm <image-name>:<tag> php artisan about
```

### Running using docker compose

> Important: You must copy the `docker-compose.yml` file to your project root directory.
```bash
# Full stack with redis
docker compose --profile with_redis up -d

# Without redis
docker compose up -d

# Only the HTTP server (without proxy)
docker compose up -d app

# Stop the containers
docker compose --profile with_redis down
docker compose down
```

## Configuration

### Recommended `Swoole` options in `octane.php`
Expand Down
63 changes: 63 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
version: '3.7'

services:

app:
build:
context: .
dockerfile: Swoole.Alpine.Dockerfile
image: php-swole-laravel-app
restart: always
env_file:
- .env
environment:
RUNNING_MIGRATIONS: true
ports:
- "8000:8000"
depends_on:
- db

horizon:
image: php-swole-laravel-app
restart: always
env_file:
- .env
environment:
CONTAINER_MODE: horizon
depends_on:
- app

scheduler:
image: php-swole-laravel-app
restart: always
env_file:
- .env
environment:
CONTAINER_MODE: scheduler
depends_on:
- app

redis:
image: redis:7-alpine
restart: always
volumes:
- redis_data:/data
profiles:
- with_redis

db:
image: mysql:latest
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: laravelapp
MYSQL_USER: user
MYSQL_PASSWORD: password
# ports:
# - "3306:3306"
volumes:
- ./data:/var/lib/mysql


volumes:
redis_data:

0 comments on commit 8ca8ec7

Please sign in to comment.