Skip to content

Commit c2b4535

Browse files
committed
Merge branch 'main' into chore/codex-instructions-guide
2 parents e2c5a04 + 3a2a134 commit c2b4535

1 file changed

Lines changed: 110 additions & 6 deletions

File tree

Tiltfile

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ backend_debug = cfg.get("debug", False)
1313
core_library_context = "./libs"
1414

1515

16+
def libs_ignore_except(include_libs):
17+
"""Return a list of paths to ignore for docker builds under the project root.
18+
19+
include_libs: list of folder names under ./libs that should NOT be ignored.
20+
All other folders under ./libs will be ignored to avoid triggering rebuilds when
21+
unrelated libraries change.
22+
"""
23+
all_libs = [
24+
"admin-api-lib",
25+
"extractor-api-lib",
26+
"rag-core-api",
27+
"rag-core-lib",
28+
]
29+
ignore = []
30+
for lib in all_libs:
31+
if lib not in include_libs:
32+
ignore.append("libs/%s/" % lib)
33+
return ignore
34+
35+
1636
def create_linter_command(folder_name, name):
1737
# Use TEST=1 for libs Dockerfile, dev=1 for service Dockerfiles
1838
build_arg = "TEST=1" if folder_name == "./libs" else "dev=1"
@@ -145,9 +165,41 @@ local_resource(
145165
################################## build backend_rag image and do live update ##########################################
146166
########################################################################################################################
147167

168+
# Base ignore patterns applied to docker_builds that reference IGNORE_BASE.
169+
# These are files and directories that should not trigger rebuilds: build artifacts,
170+
# Python caches, test caches, virtualenvs, node_modules, and other OS/tooling files.
148171
IGNORE_BASE = [
172+
# project directories we don't want to include in build context
149173
"infrastructure/",
150174
"services/frontend/",
175+
# Python caches and bytecode
176+
"**/__pycache__/",
177+
"**/*.pyc",
178+
"**/*.pyo",
179+
"**/*.py[co]",
180+
".pytest_cache/",
181+
"**/.pytest_cache/",
182+
".mypy_cache/",
183+
# virtualenvs / local python envs
184+
".venv/",
185+
"venv/",
186+
"env/",
187+
# build artifacts
188+
"build/",
189+
"dist/",
190+
"*.egg-info/",
191+
# tooling caches
192+
"node_modules/",
193+
"**/node_modules/",
194+
"services/frontend/node_modules/",
195+
# OS / editor files
196+
".DS_Store",
197+
"*.swp",
198+
"*.swo",
199+
# pytest / test caches inside libs
200+
"**/.pytest_cache/",
201+
# nix / package manager locks and temp files (optional)
202+
"**/.cache/",
151203
]
152204

153205
# NOTE: full image names should match the one in the helm chart values.yaml!
@@ -168,7 +220,7 @@ docker_build(
168220
sync(core_library_context+"/rag-core-lib", "/app/libs/rag-core-lib"),
169221
],
170222
dockerfile=backend_context + "/Dockerfile",
171-
ignore=IGNORE_BASE
223+
ignore=IGNORE_BASE + libs_ignore_except(["rag-core-api", "rag-core-lib"])
172224
)
173225

174226
# Add linter trigger
@@ -208,7 +260,7 @@ docker_build(
208260
sync(mcp_context, "/app/services/mcp-server"),
209261
],
210262
dockerfile=mcp_context + "/Dockerfile",
211-
ignore=IGNORE_BASE,
263+
ignore=IGNORE_BASE + libs_ignore_except([]),
212264
)
213265

214266
# Add linter trigger
@@ -239,11 +291,13 @@ docker_build(
239291
},
240292
live_update=[
241293
sync(admin_backend_context, "/app/services/admin-backend"),
242-
sync(core_library_context + "/rag-core-lib", "/app/libs/rag-core-lib"),
243-
sync(core_library_context + "/admin-api-lib", "/app/libs/admin-api-lib"),
294+
sync(core_library_context + "/rag-core-lib", "/app/libs/rag-core-lib"),
295+
sync(core_library_context + "/admin-api-lib", "/app/libs/admin-api-lib"),
244296
],
245297
dockerfile=admin_backend_context + "/Dockerfile",
246-
ignore=IGNORE_BASE,
298+
# Ignore rag-core-api for this build context so changes in that library
299+
# don't trigger admin-backend rebuilds (admin-backend doesn't COPY rag-core-api)
300+
ignore=IGNORE_BASE + libs_ignore_except(["rag-core-lib", "admin-api-lib"]),
247301
)
248302

249303
# Add linter trigger
@@ -287,7 +341,7 @@ docker_build(
287341
sync(core_library_context +"/extractor-api-lib", "/app/libs/extractor-api-lib"),
288342
],
289343
dockerfile=extractor_context + "/Dockerfile",
290-
ignore=IGNORE_BASE,
344+
ignore=IGNORE_BASE + libs_ignore_except(["extractor-api-lib"]),
291345
)
292346

293347
# Add linter trigger
@@ -329,10 +383,35 @@ docker_build(
329383
sync("./services/frontend/dist/libs", "/usr/share/nginx/html/libs"),
330384
],
331385
ignore=[
386+
# exclude non-frontend areas
387+
"libs/",
388+
"services/admin-backend/",
389+
"services/rag-backend/",
390+
"services/document-extractor/",
391+
"services/mcp-server/",
332392
"infrastructure/",
393+
"tools/",
394+
"docs/",
395+
".github/",
396+
".vscode/",
397+
# caches/artifacts
398+
"**/__pycache__/",
399+
"**/.pytest_cache/",
400+
".mypy_cache/",
401+
".venv/",
402+
"venv/",
403+
"env/",
404+
"build/",
405+
"dist/",
406+
"*.egg-info/",
407+
# frontend-specific caches
333408
"services/frontend/.nx/",
334409
"services/frontend/tmp/",
335410
"services/frontend/node_modules/",
411+
# OS/editor files
412+
".DS_Store",
413+
"*.swp",
414+
"*.swo",
336415
],
337416
)
338417

@@ -352,10 +431,35 @@ docker_build(
352431
sync("./services/frontend/dist/libs", "/usr/share/nginx/html/libs"),
353432
],
354433
ignore=[
434+
# exclude non-frontend areas
435+
"libs/",
436+
"services/admin-backend/",
437+
"services/rag-backend/",
438+
"services/document-extractor/",
439+
"services/mcp-server/",
355440
"infrastructure/",
441+
"tools/",
442+
"docs/",
443+
".github/",
444+
".vscode/",
445+
# caches/artifacts
446+
"**/__pycache__/",
447+
"**/.pytest_cache/",
448+
".mypy_cache/",
449+
".venv/",
450+
"venv/",
451+
"env/",
452+
"build/",
453+
"dist/",
454+
"*.egg-info/",
455+
# frontend-specific caches
356456
"services/frontend/.nx/",
357457
"services/frontend/tmp/",
358458
"services/frontend/node_modules/",
459+
# OS/editor files
460+
".DS_Store",
461+
"*.swp",
462+
"*.swo",
359463
],
360464
)
361465

0 commit comments

Comments
 (0)