docker deploy of backend now working

This commit is contained in:
martin legrand
2025-05-31 22:01:42 +02:00
parent a3b0bb22aa
commit be1bfc5cf2
4 changed files with 15 additions and 24 deletions
-5
View File
@@ -2,9 +2,6 @@
FROM --platform=linux/amd64 python:3.11-slim
ENV DEBIAN_FRONTEND=noninteractive
#RUN groupadd -r chrome && useradd -r -g chrome -G audio,video chrome
#USER chrome
# Install essential packages and Chrome dependencies
RUN apt-get update -y && apt-get install -y \
wget \
@@ -102,7 +99,5 @@ COPY config.ini .
EXPOSE 8000
#RUN chown -R chrome:chrome /app
#RUN chown -R chrome:chrome /tmp
# Run the application
CMD ["python3", "api.py"]
+1 -1
View File
@@ -84,7 +84,7 @@ services:
environment:
- SEARXNG_URL=${SEARXNG_BASE_URL:-http://searxng:8080}
- REDIS_URL=${REDIS_BASE_URL:-redis://redis:6379/0}
- WORK_DIR_HOST=${WORK_DIR_HOST:-.}
- WORK_DIR=/opt/workspace
- OPENAI_API_KEY=${OPENAI_API_KEY}
- DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
+1
View File
@@ -42,6 +42,7 @@ selenium_stealth>=1.0.6
undetected-chromedriver>=3.5.5
sentencepiece>=0.2.0
python-dotenv>=1.0.0
together>=1.5.0
tqdm>4
openai
sniffio
+13 -18
View File
@@ -49,20 +49,16 @@ class Tools():
def set_allow_language_exec_bash(value: bool) -> None:
self.allow_language_exec_bash = value
def check_config_dir_validity(self):
"""Check if the config directory is valid."""
path = self.config['MAIN']['work_dir']
if path == "":
print("WARNING: Work directory not set in config.ini")
return False
if path.lower() == "none":
print("WARNING: Work directory set to none in config.ini")
return False
if not os.path.exists(path):
print(f"WARNING: Work directory {path} does not exist")
return False
return True
def safe_get_work_dir_path(self):
path = None
path = os.getenv('WORK_DIR', path)
if path is None or path == "":
path = self.config['MAIN']['work_dir'] if 'MAIN' in self.config and 'work_dir' in self.config['MAIN'] else None
if path is None or path == "":
print("No work directory specified, using default.")
path = self.create_work_dir()
return path
def config_exists(self):
"""Check if the config file exists."""
@@ -73,11 +69,10 @@ class Tools():
default_path = os.path.dirname(os.getcwd())
if self.config_exists():
self.config.read('./config.ini')
config_path = self.config['MAIN']['work_dir'] or os.getenv('WORK_DIR')
dir_path = default_path if not self.check_config_dir_validity() else config_path
workdir_path = self.safe_get_work_dir_path()
else:
dir_path = default_path
return dir_path
workdir_path = default_path
return workdir_path
@abstractmethod
def execute(self, blocks:[str], safety:bool) -> str: