Skip to content

Commit 36762d5

Browse files
committed
Add docker compose
1 parent e5b9e13 commit 36762d5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
tfinance_bot:
3+
build: .
4+
container_name: tfinance_bot
5+
env_file:
6+
- ./.env
7+
restart: unless-stopped
8+
volumes:
9+
- ./etc_tfinance/logs:/tfinance/logs
10+
- ./etc_tfinance/sqlite:/tfinance/sqlite

tfinance/database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sqlite3
2+
from pathlib import Path
23

34
from models import User
45
from tfinance.config import DATABASE_NAME
@@ -23,6 +24,7 @@ class Database:
2324

2425
def __init__(self):
2526
# Подключение к БД с отключенной проверкой потока.
27+
Path("sqlite").mkdir(exist_ok=True)
2628
self.con = sqlite3.connect(f"{DATABASE_NAME}.db", check_same_thread=False)
2729
self.cur = self.con.cursor()
2830
self.setup()

0 commit comments

Comments
 (0)