mirror of
https://github.com/zebrajr/localGPT.git
synced 2025-12-06 12:20:53 +01:00
fix: resolve Docker container SQLite database path issue
- Updated database path from relative 'backend/chat_data.db' to absolute '/app/backend/chat_data.db' - Modified docker-compose.yml to mount entire backend directory for proper database persistence - Updated Dockerfile.backend to ensure backend directory exists in container - Fixes GitHub issue #849: sqlite3.OperationalError unable to open database file Co-Authored-By: PromptEngineer <jnfarooq@outlook.com>
This commit is contained in:
parent
3e3e83c41a
commit
f21686f51c
|
|
@ -16,8 +16,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||||
COPY backend/ ./backend/
|
COPY backend/ ./backend/
|
||||||
COPY rag_system/ ./rag_system/
|
COPY rag_system/ ./rag_system/
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories and initialize database
|
||||||
RUN mkdir -p shared_uploads logs
|
RUN mkdir -p shared_uploads logs backend
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from datetime import datetime
|
||||||
from typing import List, Dict, Optional, Tuple
|
from typing import List, Dict, Optional, Tuple
|
||||||
|
|
||||||
class ChatDatabase:
|
class ChatDatabase:
|
||||||
def __init__(self, db_path: str = "backend/chat_data.db"):
|
def __init__(self, db_path: str = "/app/backend/chat_data.db"):
|
||||||
self.db_path = db_path
|
self.db_path = db_path
|
||||||
self.init_database()
|
self.init_database()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ services:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- RAG_API_URL=http://rag-api:8001
|
- RAG_API_URL=http://rag-api:8001
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend/chat_data.db:/app/backend/chat_data.db
|
- ./backend:/app/backend
|
||||||
- ./shared_uploads:/app/shared_uploads
|
- ./shared_uploads:/app/shared_uploads
|
||||||
depends_on:
|
depends_on:
|
||||||
rag-api:
|
rag-api:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user