backend_v0.1
This commit is contained in:
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
environment:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: fastapi_db
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
web:
|
||||
image: python:3.11-slim
|
||||
command: >
|
||||
sh -c "pip install -r requirements.txt && python -Xfrozen_modules=off -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
|
||||
# 需要debug时使用
|
||||
# sh -c "pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple && python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:5678 --wait-for-client -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
|
||||
volumes:
|
||||
- .:/code
|
||||
working_dir: /code
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "5678:5678" # 暴露调试端口
|
||||
environment:
|
||||
- DATABASE_URL=postgresql+asyncpg://user:password@db:5432/fastapi_db
|
||||
depends_on:
|
||||
- db
|
||||
Reference in New Issue
Block a user