-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.worker
More file actions
53 lines (46 loc) · 2.28 KB
/
Copy pathDockerfile.worker
File metadata and controls
53 lines (46 loc) · 2.28 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
# ---- CFDQandA Worker ----
# Based on leoyue123/foamagent which already includes:
# - OpenFOAM v10
# - Miniconda + FoamAgent conda env (Python 3.12, LangGraph, FAISS, etc.)
#
# This Dockerfile adds:
# 1. Worker-specific Python deps (supabase, python-dotenv) into the conda env
# 2. The 4 cfdqanda-server Worker scripts
#
# Foam-Agent code is bind-mounted at runtime (not baked in) so we can
# update it independently via git pull without rebuilding the image.
#
# Build: docker build -f Dockerfile.worker -t cfdqanda-worker .
# Run: docker run --env-file .env -v /path/to/Foam-Agent:/home/openfoam/Foam-Agent cfdqanda-worker
# Size: ~28.5 GB (conda 16.3G + OpenFOAM 11G + boost/pip/src ~1.2G)
# The base image is very large due to full PyTorch+CUDA+ML stack in conda.
# See Foam-Agent-Comments.md for optimization suggestions.
FROM leoyue123/foamagent:latest
# --- Install Worker-specific dependencies into the FoamAgent conda env ---
# The base image's conda env does not include supabase or python-dotenv.
# Use the conda env's pip directly (entrypoint is not active during build).
RUN apt-get update \
&& apt-get install -y --no-install-recommends git-lfs \
&& git lfs install \
&& rm -rf /var/lib/apt/lists/*
RUN /opt/conda/envs/FoamAgent/bin/pip install --no-cache-dir \
supabase python-dotenv langchain-huggingface sentence-transformers \
--upgrade faiss-cpu
# --- Copy Worker scripts into the image ---
# These are our cfdqanda-server files that orchestrate Foam-Agent execution.
WORKDIR /app/worker
COPY worker.py .
COPY allrun_validator.py .
COPY token_extractor.py .
COPY mcp_client.py .
COPY case_lint.py .
# --- Worker entrypoint ---
# The base image's entrypoint (foamagent-entrypoint.sh) sources OpenFOAM and
# activates the FoamAgent conda env, then exec's the passed command.
# We override CMD to run our Worker instead of an interactive bash shell.
#
# The entrypoint handles:
# 1. source /opt/openfoam10/etc/bashrc (OpenFOAM env vars + PATH)
# 2. conda activate FoamAgent (Python 3.12 + all ML/CFD deps)
# 3. exec "$@" (runs our CMD below)
CMD ["sh", "-c", "git config --global --add safe.directory /home/openfoam/Foam-Agent && cd /home/openfoam/Foam-Agent && git lfs pull && exec python -u /app/worker/worker.py"]