File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,20 @@ ENV IS_USING_IMAGE_RUNTIME=True
1717# Copy application code
1818COPY src/ ${LAMBDA_TASK_ROOT}/
1919
20+ # Generate ChromaDB embeddings at build time (requires AWS credentials as build args)
21+ ARG AWS_ACCESS_KEY_ID
22+ ARG AWS_SECRET_ACCESS_KEY
23+ ARG AWS_DEFAULT_REGION=us-east-1
24+ COPY populate_database.py ${LAMBDA_TASK_ROOT}/
25+ RUN if [ -n "$AWS_ACCESS_KEY_ID" ]; then \
26+ AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
27+ AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
28+ AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} \
29+ python populate_database.py --reset; \
30+ else \
31+ echo "Skipping DB population (no AWS credentials)" ; \
32+ fi && \
33+ rm populate_database.py
34+
2035# Lambda entry point to run the FastAPI server
2136CMD ["app_api_handler.handler" ]
22-
Original file line number Diff line number Diff line change 2424logging .basicConfig (level = logging .INFO )
2525logger = logging .getLogger (__name__ )
2626
27- CHROMA_PATH = "src/data/chroma"
28- DATA_SOURCE_PATH = "src/data/source"
27+ # Paths work both locally (from docker_image/) and inside Docker (from /var/task/)
28+ _in_docker = os .path .exists ("/var/task" )
29+ CHROMA_PATH = "data/chroma" if _in_docker else "src/data/chroma"
30+ DATA_SOURCE_PATH = "data/source" if _in_docker else "src/data/source"
2931
3032
3133def main ():
You can’t perform that action at this time.
0 commit comments