luluka #2

Merged
Arxip222 merged 4 commits from luluka into main 2025-12-22 23:39:27 +03:00
5 changed files with 119 additions and 10 deletions
Showing only changes of commit c210c4a3c5 - Show all commits

35
.dockerignore Normal file
View File

@ -0,0 +1,35 @@
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
venv/
env/
ENV/
.venv/
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
.git/
.gitignore
.gitattributes
Dockerfile*
docker-compose*.yml
.dockerignore
drone.yml
tmp/
temp/
*.tmp
Thumbs.db
.DS_Store

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
# Python
__pycache__/ __pycache__/
*.pyc *.pyc
*.pyo *.pyo

View File

@ -2,10 +2,12 @@ services:
postgres: postgres:
image: postgres:15-alpine image: postgres:15-alpine
restart: unless-stopped restart: unless-stopped
env_file:
- .env
environment: environment:
POSTGRES_USER: postgres POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: lawyer_ai POSTGRES_DB: ${POSTGRES_DB}
ports: ports:
- "5432:5432" - "5432:5432"
volumes: volumes:
@ -30,17 +32,22 @@ services:
backend: backend:
build: ./backend build: ./backend
restart: unless-stopped restart: unless-stopped
env_file:
- .env
environment: environment:
POSTGRES_HOST: postgres POSTGRES_HOST: postgres
POSTGRES_PORT: 5432 POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: postgres POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: lawyer_ai POSTGRES_DB: ${POSTGRES_DB}
QDRANT_HOST: qdrant QDRANT_HOST: qdrant
QDRANT_PORT: 6333 QDRANT_PORT: ${QDRANT_PORT}
REDIS_HOST: redis REDIS_HOST: redis
REDIS_PORT: 6379 REDIS_PORT: ${REDIS_PORT}
DEBUG: "true" DEBUG: "true"
SECRET_KEY: ${SECRET_KEY}
APP_NAME: ${APP_NAME}
CORS_ORIGINS: ${CORS_ORIGINS}
ports: ports:
- "8000:8000" - "8000:8000"
depends_on: depends_on:
@ -48,6 +55,26 @@ services:
- qdrant - qdrant
- redis - redis
tg_bot:
build: ./tg_bot
restart: unless-stopped
env_file:
- .env
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
DEEPSEEK_API_URL: ${DEEPSEEK_API_URL:-https://api.deepseek.com/v1/chat/completions}
YANDEX_OCR_API_KEY: ${YANDEX_OCR_API_KEY}
DEBUG: "true"
depends_on:
- postgres
- backend
volumes: volumes:
postgres_data: postgres_data:
qdrant_data: qdrant_data:

30
drone.yml Normal file
View File

@ -0,0 +1,30 @@
kind: pipeline
type: docker
name: deploy-backend
trigger:
event:
- push
- pull_request
- tag
branch:
- main
steps:
- name: deploy-backend
image: appleboy/drone-ssh
settings:
host:
from_secret: server_host
username:
from_secret: server_username
password:
from_secret: server_password
port: 22
script:
- cd BETTERCALLPRASKOVIA
- git pull origin main
- docker-compose stop backend tg_bot
- docker-compose up --build -d backend tg_bot
- docker system prune -f

18
tg_bot/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
gcc \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
CMD ["python", "tg_bot/main.py"]