API Dockerfile: install camera SDK from local tarball under camera_sdk; compose: build API image and set LD_LIBRARY_PATH fallback

This commit is contained in:
Alireza Vaezi
2025-08-07 21:25:58 -04:00
parent 458c04608c
commit cf0bb48fac
2 changed files with 31 additions and 2 deletions

View File

@@ -2,15 +2,20 @@ version: "3.9"
services:
api:
image: python:3.11-slim
build:
context: ./api
dockerfile: Dockerfile
working_dir: /app
volumes:
- ./api:/app
- ./api/storage:/storage
environment:
- PYTHONUNBUFFERED=1
- LD_LIBRARY_PATH=/usr/local/lib:/app/camera_sdk/lib
command: >
sh -lc "
apt-get update && apt-get install -y libusb-1.0-0-dev;
if [ -d camera_sdk/lib ]; then cp camera_sdk/lib/* /usr/local/lib/ 2>/dev/null || true; fi;
if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; else pip install --no-cache-dir -e .; fi;
python main.py --config config.compose.json
"
@@ -47,4 +52,3 @@ services:
volumes:
mosquitto-data:
mosquitto-conf: