Skip to content

Instantly share code, notes, and snippets.

@insolor
Last active August 30, 2022 19:01
Show Gist options
  • Save insolor/2c6b7c5b859ff8fe89b39ded4fa539bd to your computer and use it in GitHub Desktop.
Save insolor/2c6b7c5b859ff8fe89b39ded4fa539bd to your computer and use it in GitHub Desktop.
Custom docker-compose.yml for fastapi-admin demo, which runs mysql and redis along with the fastapi-admin
version: "3"
services:
db:
image: mysql:latest
environment:
MYSQL_DATABASE: 'fastapi-admin'
MYSQL_ROOT_PASSWORD: '123456'
ports:
- '3306:3306'
volumes:
- my-db:/var/lib/mysql
redis:
image: "redis:alpine"
command: redis-server
ports:
- "6379:6379"
volumes:
- redis-data:/var/lib/redis
environment:
- REDIS_REPLICATION_MODE=master
app:
environment:
- DATABASE_URL=mysql://root:123456@127.0.0.1:3306/fastapi-admin
- REDIS_URL=redis://localhost:6379/0
build: .
restart: always
# env_file: .env
network_mode: host
image: fastapi-admin
command: uvicorn examples.main:app_ --port 8000 --host 0.0.0.0
depends_on:
- db
- redis
volumes:
my-db:
redis-data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment