a1c00l commited on
Commit
917a5e4
·
verified ·
1 Parent(s): 1bcacbd

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +20 -0
  2. entrypoint.sh +30 -0
  3. requirements.txt +12 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy application code
10
+ COPY src/ /app/src/
11
+
12
+ # Set environment variables
13
+ ENV PYTHONPATH=/app
14
+
15
+ # Create entrypoint script
16
+ COPY entrypoint.sh /app/
17
+ RUN chmod +x /app/entrypoint.sh
18
+
19
+ # Command to run the application
20
+ ENTRYPOINT ["/app/entrypoint.sh"]
entrypoint.sh ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Default values
5
+ DEFAULT_INFERENCE_URL="http://inference-model:8000/extract"
6
+
7
+ # Check if AIBOM_INFERENCE_URL is set, otherwise use default
8
+ if [ -z "$AIBOM_INFERENCE_URL" ]; then
9
+ export AIBOM_INFERENCE_URL=$DEFAULT_INFERENCE_URL
10
+ echo "AIBOM_INFERENCE_URL not set, using default: $AIBOM_INFERENCE_URL"
11
+ fi
12
+
13
+ # Check if command is provided
14
+ if [ "$1" = "server" ]; then
15
+ # Start the API server
16
+ echo "Starting AIBOM Generator API server..."
17
+ exec uvicorn src.aibom_generator.api:app --host 0.0.0.0 --port ${PORT:-5000}
18
+ elif [ "$1" = "worker" ]; then
19
+ # Start the background worker
20
+ echo "Starting AIBOM Generator background worker..."
21
+ exec python -m src.aibom_generator.worker
22
+ elif [ "$1" = "inference" ]; then
23
+ # Start the inference model server
24
+ echo "Starting AIBOM Generator inference model server..."
25
+ exec python -m src.aibom_generator.inference_model --host 0.0.0.0 --port ${PORT:-8000}
26
+ else
27
+ # Default: run as CLI
28
+ echo "Running AIBOM Generator CLI..."
29
+ exec python -m src.aibom_generator.cli "$@"
30
+ fi
requirements.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ huggingface_hub>=0.19.0
2
+ transformers>=4.36.0
3
+ torch>=2.0.0
4
+ fastapi>=0.104.0
5
+ uvicorn>=0.24.0
6
+ pydantic>=2.4.0
7
+ requests>=2.31.0
8
+ python-dotenv>=1.0.0
9
+ PyYAML>=6.0.1
10
+ flask>=2.3.0
11
+ gunicorn>=21.2.0
12
+ cyclonedx-python-lib>=4.0.0