bd - api
This commit is contained in:
51
docker-compose.yml
Normal file
51
docker-compose.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# База данных PostgreSQL (отдельный сервис)
|
||||
postgres:
|
||||
image: postgres:15
|
||||
container_name: telegram_bot_db
|
||||
environment:
|
||||
POSTGRES_DB: telegram_bot
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
networks:
|
||||
- bot_network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -h localhost -p 5432 -q -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Единое приложение (API + database логика в одном контейнере)
|
||||
app:
|
||||
build: .
|
||||
container_name: telegram_bot_app
|
||||
environment:
|
||||
# Настройки подключения к внешней PostgreSQL
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
DB_NAME: telegram_bot
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: password
|
||||
|
||||
# Настройки API сервера
|
||||
API_HOST: 0.0.0.0
|
||||
API_PORT: 8000
|
||||
API_RELOAD: "false"
|
||||
LOG_LEVEL: INFO
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- bot_network
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
Reference in New Issue
Block a user