Skip to content

Commit

Permalink
added dep and defaults for build_docker.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
faberf committed May 15, 2024
1 parent 52e562f commit 08fa782
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
48 changes: 6 additions & 42 deletions build_docker.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/core/install_system_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
apt-get install -y gcc python3-dev libsndfile1 ffmpeg libsm6 libxext6 cmake build-essential
apt-get install -y gcc python3-dev libsndfile1 ffmpeg libsm6 libxext6 cmake build-essential libssl-dev

0 comments on commit 08fa782

Please sign in to comment.