-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
50 lines (50 loc) · 1.26 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
services:
db:
image: postgres:latest
container_name: postgres-bot
restart: always
user: ${POSTGRES_USER}
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
ports:
- '${POSTGRES_PORT}:${POSTGRES_PORT}'
volumes:
# to persist data
- db:/var/lib/postgresql/data
# copy the sql script to create tables
- ./storage/schema/bot.sql:/docker-entrypoint-initdb.d/create_tables.sql
bot:
container_name: tutnews-bot
image: python:3.9
restart: unless-stopped
depends_on:
- db
volumes:
- .:/app
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=db
- BOT_TOKEN=${BOT_TOKEN}
- API_HASH=${API_HASH}
- API_ID=${API_ID}
- SCROLLING_TIMEOUT_MIN=${SCROLLING_TIMEOUT_MIN}
- PYTHONPATH=/app
working_dir: /app
command: >
sh -c "
pip install -r requirements.txt &&
python bot/main.py
"
volumes:
db:
driver: local