tmpl-fastapi/docker-compose.yml

38 lines
810 B
YAML
Raw Normal View History

version: "3"
services:
app:
image: ${REPO_OWNER_LOWER}/${REPO_NAME_SNAKE}:latest
container_name: ${REPO_NAME_SNAKE}
restart: unless-stopped
ports:
- "8080:8000"
links:
- database
env_file: .env
depends_on:
database:
condition: service_healthy
database:
image: mariadb:latest
container_name: ${REPO_NAME_SNAKE}_db
restart: unless-stopped
volumes:
#- "./database:/var/lib/mysql"
- "db_data:/var/lib/mysql"
env_file: .env_db
healthcheck:
test: sh -c "mysqladmin ping -u$$$$MYSQL_USER -p$$$$MYSQL_PASSWORD"
interval: 1s
timeout: 3s
retries: 20
# Comment or remove these lines and
# edit `volumes` in services->database
# if you are going to store
# your DB in a directory
volumes:
db_data: