From 08fa782dce4686c8952a134c81a8762730cc9399 Mon Sep 17 00:00:00 2001 From: faberf Date: Wed, 15 May 2024 18:48:01 +0200 Subject: [PATCH] added dep and defaults for build_docker.sh --- README.md | 2 +- build_docker.sh | 48 ++++--------------------- src/core/install_system_dependencies.sh | 2 +- 3 files changed, 8 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 839677e..ea5ccdc 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Follow these steps to run the server using Docker: After pulling the image, you can run it using the following command: ```bash - sudo docker run -it -p 5000:8888 -v ~/.cache:/root/.cache -v ./logs:/app/logs -e LOG_LEVEL=DEBUG -t faberf/featureextractionserver:full + sudo docker run -it -p 5000:8888 -v ~/.cache:/root/.cache -v ./logs:/app/logs -e LOG_LEVEL=DEBUG -t vitrivr/featureextractionserver:full ``` This command will start a Docker container from the image and map port 5000 of your machine to port 5000 of the Docker container. This also demonstrates how you can bind the `/root/.cache` directory to your local `.cache` directory in order to persist the downloaded machine learning models between runs, saving time. diff --git a/build_docker.sh b/build_docker.sh index de2a1e9..6192c30 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -1,6 +1,8 @@ #!/bin/bash -# Check if the buildx builder "mybuilder" already exists, if not create it +DOCKER_USERNAME="${1:-$DOCKER_USERNAME}" +VERSION="${2:-$VERSION}" + if ! docker buildx inspect mybuilder > /dev/null 2>&1; then docker buildx create --name mybuilder --driver docker-container --use else @@ -22,12 +24,13 @@ build_image() { . } + # Building base image build_image "base" \ "core:simple_plugin_manager:base_api:fastapi" \ "run-fes --port 8888 --host 0.0.0.0" -# Building base image +# Building dino image build_image "dino" \ "core:simple_plugin_manager:base_api:fastapi:dino_v2_vits14:image_embedding" \ "run-fes --port 8888 --host 0.0.0.0" @@ -58,43 +61,4 @@ build_image "full" \ "run-fes --port 8888 --host 0.0.0.0" # Remove the buildx builder -docker buildx rm mybuilder - - -# if ((BASH_VERSINFO[0] < 4)); then -# echo "Bash version 4.0 or higher is required." -# exit 1 -# fi - -# declare -A targets -# targets["base"]="simple_plugin_manager:base_api:fastapi" -# targets["full"]="audio_diarization:blip:conditional_image_captioning:face_embedding:image_captioning:optical_character_recognition:simple_plugin_manager:vit_gpt2:automated_speech_recognition:blip2:detr_resnet101:face_recognition:image_embedding:owl_vit_base_patch32:tesseract:whisper:base_api:clip_vit_large_patch14:easy_ocr:fastapi:object_detection:pyannote:text_embedding:zero_shot_image_classification" -# targets["clip"]="simple_plugin_manager:image_embedding:base_api:clip_vit_large_patch14:fastapi:text_embedding:zero_shot_image_classification" -# targets["blip2"]="simple_plugin_manager:image_captioning:base_api:blip2:fastapi:conditional_image_captioning" -# targets["whisper"]="simple_plugin_manager:base_api:whisper:fastapi:automated_speech_recognition" -# targets["tesseract"]="simple_plugin_manager:base_api:tesseract:fastapi:optical_character_recognition" - -# # Function to build a Docker image for a given target -# build_image() { -# local target=$1 - -# # Check if the target exists in the array -# if [[ -z ${targets[$target]} ]]; then -# echo "Error: Target '$target' is not defined in the targets array." -# return 1 # Exit the function with an error status -# fi - -# local pluginpath=${targets[$target]} -# echo "Building image for $target with plugins from $pluginpath" - -# # debug why target is 0 instead of base -# echo "target: $target" - -# # Build the Docker image using the specified PLUGINPATH -# docker buildx build --build-arg PLUGINPATH="$pluginpath" -t "featureextractionserver:$target" . -# } - -# # Build images for all defined targets -# for target in "${!targets[@]}"; do -# build_image "$target" -# done +docker buildx rm mybuilder \ No newline at end of file diff --git a/src/core/install_system_dependencies.sh b/src/core/install_system_dependencies.sh index 8b98d01..2ff2ab4 100644 --- a/src/core/install_system_dependencies.sh +++ b/src/core/install_system_dependencies.sh @@ -1 +1 @@ -apt-get install -y gcc python3-dev libsndfile1 ffmpeg libsm6 libxext6 cmake build-essential \ No newline at end of file +apt-get install -y gcc python3-dev libsndfile1 ffmpeg libsm6 libxext6 cmake build-essential libssl-dev \ No newline at end of file