vorbereiten des docker deployments
This commit is contained in:
142
docker-compose.yml
Normal file
142
docker-compose.yml
Normal file
@@ -0,0 +1,142 @@
|
||||
version: "3.9"
|
||||
|
||||
networks:
|
||||
backend:
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
storage_data:
|
||||
bootstrap_cache:
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
target: php_app
|
||||
image: stylegallery-app:latest
|
||||
env_file:
|
||||
- .env.docker
|
||||
restart: unless-stopped
|
||||
command: >
|
||||
sh -c "
|
||||
chown -R www-data:www-data storage bootstrap/cache &&
|
||||
php artisan storage:link --ansi || true &&
|
||||
php artisan config:cache --ansi &&
|
||||
php artisan route:cache --ansi &&
|
||||
php artisan view:cache --ansi &&
|
||||
php-fpm
|
||||
"
|
||||
volumes:
|
||||
- storage_data:/var/www/html/storage
|
||||
- bootstrap_cache:/var/www/html/bootstrap/cache
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- backend
|
||||
healthcheck:
|
||||
test: ["CMD", "php", "-v"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
queue:
|
||||
build:
|
||||
context: .
|
||||
target: php_app
|
||||
image: stylegallery-app:latest
|
||||
env_file:
|
||||
- .env.docker
|
||||
restart: unless-stopped
|
||||
command: ["sh", "-c", "php artisan queue:work --sleep=3 --tries=3 --max-time=3600"]
|
||||
volumes:
|
||||
- storage_data:/var/www/html/storage
|
||||
- bootstrap_cache:/var/www/html/bootstrap/cache
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- backend
|
||||
|
||||
scheduler:
|
||||
build:
|
||||
context: .
|
||||
target: php_app
|
||||
image: stylegallery-app:latest
|
||||
env_file:
|
||||
- .env.docker
|
||||
restart: unless-stopped
|
||||
command: ["sh", "-c", "php artisan schedule:work"]
|
||||
volumes:
|
||||
- storage_data:/var/www/html/storage
|
||||
- bootstrap_cache:/var/www/html/bootstrap/cache
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- backend
|
||||
|
||||
nginx:
|
||||
build:
|
||||
context: .
|
||||
target: nginx
|
||||
image: stylegallery-nginx:latest
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_started
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- backend
|
||||
volumes:
|
||||
- storage_data:/var/www/html/storage:ro
|
||||
- bootstrap_cache:/var/www/html/bootstrap/cache:ro
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
env_file:
|
||||
- .env.docker
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||
command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
networks:
|
||||
- backend
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mysqladmin ping -h localhost -p${DB_PASSWORD}"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
env_file:
|
||||
- .env.docker
|
||||
restart: unless-stopped
|
||||
command: ["sh", "-c", "exec redis-server --appendonly yes --requirepass \"$REDIS_PASSWORD\""]
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- backend
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
Reference in New Issue
Block a user