-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (58 loc) · 1.51 KB
/
Dockerfile
File metadata and controls
68 lines (58 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Dockerfile for BESSER Modeling Agent
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the modeling agent code
COPY . .
# Expose the websocket port
EXPOSE 8765
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src:/app
# Create entrypoint script that generates config.yaml from environment variables
RUN echo '#!/bin/bash\n\
set -e\n\
\n\
# Generate config.yaml from environment variables\n\
cat > /app/config.yaml << EOF\n\
agent:\n\
check_transitions_delay: 5\n\
\n\
nlp:\n\
language: en\n\
region: US\n\
timezone: Europe/Madrid\n\
pre_processing: True\n\
intent_threshold: 0.55\n\
openai:\n\
api_key: ${OPENAI_API_KEY:-}\n\
\n\
platforms:\n\
websocket:\n\
host: 0.0.0.0\n\
port: 8765\n\
streamlit:\n\
host: localhost\n\
port: 5000\n\
EOF\n\
\n\
echo "✅ config.yaml created successfully"\n\
cat /app/config.yaml\n\
\n\
# Run the modeling agent\n\
exec python modeling_agent.py\n\
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import socket; s=socket.socket(); s.connect(('localhost', 8765)); s.close()" || exit 1
# Run the entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]