106 lines
3.0 KiB
YAML
106 lines
3.0 KiB
YAML
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/production/Dockerfile
|
|
target: app
|
|
args:
|
|
APP_UID: '${WWWUSER:-1000}'
|
|
APP_GID: '${WWWGROUP:-1000}'
|
|
image: moonwell-web-app:production
|
|
restart: unless-stopped
|
|
init: true
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
APP_ENV: production
|
|
APP_DEBUG: 'false'
|
|
DB_HOST: mysql
|
|
DB_PORT: 3306
|
|
volumes:
|
|
- './storage:/var/www/html/storage'
|
|
tmpfs:
|
|
- '/var/www/html/bootstrap/cache:uid=${WWWUSER:-1000},gid=${WWWGROUP:-1000},mode=0770'
|
|
networks:
|
|
- sail
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test:
|
|
- CMD-SHELL
|
|
- 'SCRIPT_NAME=/healthz SCRIPT_FILENAME=/healthz REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000 2>/dev/null | grep -q pong'
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/production/Dockerfile
|
|
target: web
|
|
args:
|
|
APP_UID: '${WWWUSER:-1000}'
|
|
APP_GID: '${WWWGROUP:-1000}'
|
|
image: moonwell-web-nginx:production
|
|
restart: unless-stopped
|
|
init: true
|
|
ports:
|
|
- '127.0.0.1:${APP_PORT:-8080}:8080'
|
|
volumes:
|
|
- './storage/app/public:/var/www/html/public/storage:ro'
|
|
networks:
|
|
- sail
|
|
depends_on:
|
|
app:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ['CMD', 'wget', '--quiet', '--tries=1', '--spider', 'http://127.0.0.1:8080/healthz']
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
|
|
mysql:
|
|
image: mysql:8.4
|
|
restart: unless-stopped
|
|
ports:
|
|
- '${FORWARD_DB_PORT:-3307}:3306'
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
|
|
MYSQL_ROOT_HOST: '%'
|
|
MYSQL_DATABASE: '${DB_DATABASE}'
|
|
MYSQL_USER: '${DB_USERNAME}'
|
|
MYSQL_PASSWORD: '${DB_PASSWORD}'
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
|
MYSQL_EXTRA_OPTIONS: '${MYSQL_EXTRA_OPTIONS:-}'
|
|
volumes:
|
|
- 'sail-mysql:/var/lib/mysql'
|
|
- './docker/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
|
|
networks:
|
|
- sail
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- mysqladmin
|
|
- ping
|
|
- '-p${DB_PASSWORD}'
|
|
retries: 3
|
|
timeout: 5s
|
|
|
|
networks:
|
|
sail:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
sail-mysql:
|
|
driver: local
|