Add dockerization

This commit is contained in:
estromenko 2025-10-21 20:04:45 +03:00
parent 0e11605edd
commit 10ef163ecb
7 changed files with 100 additions and 2 deletions

34
.dockerignore Normal file
View File

@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/
**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
# syntax=docker/dockerfile:1
FROM python:3.13-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV UV_SYSTEM_PYTHON=1
WORKDIR /app
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
git && rm -rf /var/lib/apt/lists/*
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
uv sync --no-dev --locked --no-install-project
COPY . .
USER appuser

0
backend/__init__.py Normal file
View File

View File

@ -1,3 +1,4 @@
import os
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
@ -22,10 +23,16 @@ SYSTEM_PROMPT = """
Поиск в интернете можно делать не более 1 раза за запрос пользователя.
"""
redis = Redis()
redis = Redis(host=os.getenv("REDIS_HOST", "localhost"))
llm = ChatOpenAI(model_name="gpt-5")
embedding = DeepInfraEmbeddings(model_id="Qwen/Qwen3-Embedding-8B")
vectorstore = Clickhouse(embedding, ClickhouseSettings(port=8123, username="default", password="", index_type="vector_similarity"))
vectorstore = Clickhouse(embedding, ClickhouseSettings(
host=os.getenv("CLICKHOUSE_HOST", "localhost"),
port=8123,
username="default",
password="",
index_type="vector_similarity",
))
search_tool = DuckDuckGoSearchRun()

View File

@ -1,3 +1,7 @@
import sys
sys.path.append(".")
import os
import io
import traceback

View File

@ -1,3 +1,7 @@
import sys
sys.path.append(".")
from backend.agent import vectorstore
from langchain_core.documents import Document
import clickhouse_connect

View File

@ -18,3 +18,18 @@ services:
restart: always
ports:
- "127.0.0.1:6379:6379"
bot:
image: vision-career:latest
build: .
command: [".venv/bin/python", "backend/bot.py"]
restart: always
environment:
CLICKHOUSE_HOST: clickhouse
REDIS_HOST: valkey
init: true
env_file:
- .env
develop:
watch:
- action: rebuild
path: .