52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
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
|
|
|
|
|