fix: deploy

This commit is contained in:
KofK 2025-02-16 18:07:38 +03:00
parent 3928cbcd61
commit 3f1ccfdbfe
4 changed files with 34 additions and 12 deletions

View File

@ -9,14 +9,9 @@ RUN apt-get update && \
# Рабочая директория # Рабочая директория
WORKDIR /app WORKDIR /app
# Сначала копируем только зависимости # Копируем весь код и устанавливаем зависимости
COPY requirements.txt . COPY . .
# Устанавливаем зависимости с кэшированием
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Копируем остальные файлы # Команда для запуска
COPY . .
# Команда для запуска (замените на вашу)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -2,7 +2,9 @@ version: "3.8"
services: services:
qdrant: qdrant:
image: qdrant/qdrant build:
context: ./qdrant
dockerfile: Dockerfile
container_name: qdrant container_name: qdrant
ports: ports:
- "6333:6333" - "6333:6333"
@ -10,6 +12,11 @@ services:
volumes: volumes:
- qdrant_data:/qdrant/storage - qdrant_data:/qdrant/storage
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6333/collections"]
interval: 10s
timeout: 5s
retries: 5
backend: backend:
build: build:
@ -19,6 +26,12 @@ services:
ports: ports:
- "8000:8000" - "8000:8000"
restart: unless-stopped restart: unless-stopped
depends_on:
qdrant:
condition: service_healthy
environment:
- QDRANT_HOST=qdrant
- QDRANT_PORT=6333
futa-clone: futa-clone:
build: build:
@ -29,5 +42,16 @@ services:
- "3000:3000" - "3000:3000"
restart: unless-stopped restart: unless-stopped
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
volumes: volumes:
qdrant_data: qdrant_data:
ollama_data:

View File

@ -38,8 +38,8 @@ logger = logging.getLogger(__name__)
COLLECTION_NAME = "posts" COLLECTION_NAME = "posts"
VECTOR_SIZE = 1280 VECTOR_SIZE = 1280
DATABASE_URL = "sqlite:///./imageboard.db" DATABASE_URL = "sqlite:///./imageboard.db"
QDRANT_URL = "http://localhost:6333" QDRANT_URL = "http://qdrant:6333"
OLLAMA_URL = "http://localhost:11434" OLLAMA_URL = "http://ollama:11434"
EMBEDDING_MODEL = "nomic-embed-text" EMBEDDING_MODEL = "nomic-embed-text"
IMAGE_MODEL = "openai/clip-vit-base-patch32" IMAGE_MODEL = "openai/clip-vit-base-patch32"
IMAGE_SIZE = (224, 224) IMAGE_SIZE = (224, 224)

3
qdrant/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM qdrant/qdrant
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*