Files
bortstack-forge/templates/flask-react/source/docker-compose.yml
T

81 lines
1.9 KiB
YAML

services:
mysql:
image: mysql:8.4
restart: unless-stopped
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:?MYSQL_DATABASE must be set}
MYSQL_USER: ${MYSQL_USER:?MYSQL_USER must be set}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?MYSQL_PASSWORD must be set}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?MYSQL_ROOT_PASSWORD must be set}
volumes:
- db:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -p$$MYSQL_ROOT_PASSWORD --silent"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- internal
api:
image: ${API_IMAGE:-__APP_SLUG__-api:local}
build:
context: ./api
restart: unless-stopped
init: true
stop_grace_period: 30s
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
env_file:
- ${APP_ENV_FILE:-.env.example}
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/api/health/ready')"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
ports:
- "127.0.0.1:5001:5000"
networks:
- internal
nginx:
image: ${NGINX_IMAGE:-__APP_SLUG__-nginx:local}
build:
context: .
dockerfile: nginx/Dockerfile
restart: unless-stopped
init: true
stop_grace_period: 15s
security_opt:
- no-new-privileges:true
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1/"]
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
ports:
- "127.0.0.1:8081:80"
networks:
- internal
networks:
internal:
internal: true
volumes:
db: