add docker service
This commit is contained in:
parent
717f1b0306
commit
33c90d6d4e
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM python:3.12-alpine
|
||||||
|
RUN apk add --no-cache linux-headers g++ build-base \
|
||||||
|
libressl-dev libxslt-dev libgcrypt-dev musl-dev libffi-dev libxml2 libxslt libc-dev
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
COPY . .
|
@ -9,7 +9,7 @@ if load_dotenv('local.env') is False:
|
|||||||
load_dotenv('.env')
|
load_dotenv('.env')
|
||||||
|
|
||||||
|
|
||||||
def get_logger(filename: str = "main.log", level: str = "INFO") -> Logger:
|
def get_logger(filename: str = "/volumes/app/main.log", level: str = "INFO") -> Logger:
|
||||||
logger.remove()
|
logger.remove()
|
||||||
logger.add(filename, level=level, rotation="5 MB")
|
logger.add(filename, level=level, rotation="5 MB")
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ def get_logger(filename: str = "main.log", level: str = "INFO") -> Logger:
|
|||||||
|
|
||||||
class Secrets:
|
class Secrets:
|
||||||
bot_token: str = os.getenv("bot_token")
|
bot_token: str = os.getenv("bot_token")
|
||||||
redis_url: str = os.getenv("redis_url")
|
redis_url: str = "redis://redis_telegram_bot:6379"
|
||||||
|
|
||||||
|
|
||||||
SECRETS = Secrets()
|
SECRETS = Secrets()
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
redis:
|
redis_telegram_bot:
|
||||||
image: redis
|
image: redis
|
||||||
container_name: redis
|
container_name: redis_telegram_bot
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
env_file:
|
env_file:
|
||||||
@ -13,3 +13,24 @@ services:
|
|||||||
- REDIS_REPLICATION_MODE=master
|
- REDIS_REPLICATION_MODE=master
|
||||||
restart: always
|
restart: always
|
||||||
command: "redis-server --appendonly yes --replica-read-only no"
|
command: "redis-server --appendonly yes --replica-read-only no"
|
||||||
|
|
||||||
|
telegram_bot:
|
||||||
|
image: telegram_bot
|
||||||
|
container_name: telegram_bot
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: backend.Dockerfile
|
||||||
|
working_dir: /app
|
||||||
|
depends_on:
|
||||||
|
- redis_telegram_bot
|
||||||
|
links:
|
||||||
|
- redis_telegram_bot
|
||||||
|
volumes:
|
||||||
|
- ./app:/app
|
||||||
|
- ./volumes/app:/volumes/app
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
restart: always
|
||||||
|
command: python main.py
|
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
0
volumes/app/.gitkeep
Normal file
0
volumes/app/.gitkeep
Normal file
Loading…
x
Reference in New Issue
Block a user