Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ jobs:
fi
cicd/build.sh
cicd/test.sh
cicd/docker_clean.sh
if [ "$USE_HF_AUTH_TOKEN" = true ]; then
rm -f token.txt
fi
Expand All @@ -215,8 +216,15 @@ jobs:
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
HF_TOKEN: ${{secrets.HF_TOKEN}}
run: |
if [ "$USE_HF_AUTH_TOKEN" = true ]; then
printf '%s' "$HF_TOKEN" > token.txt
fi
cicd/docker_push.sh
if [ "$USE_HF_AUTH_TOKEN" = true ]; then
rm -f token.txt
fi
build-custom-image:
name: Build custom image
runs-on: ubuntu-latest-8-cores
Expand Down
2 changes: 1 addition & 1 deletion cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ else
--build-arg "USE_QUERY_PASSAGE_PREFIXES=$use_query_passage_prefixes" \
--build-arg "USE_QUERY_PROMPT=$use_query_prompt" \
-t "$local_repo" .
fi
fi
11 changes: 11 additions & 0 deletions cicd/docker_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eou pipefail

echo "Stop all docker containers"
docker ps -q | xargs --no-run-if-empty docker stop
echo "Delete all docker containers"
docker ps -a -q | xargs --no-run-if-empty docker rm
echo "Delete all docker images"
docker images -q | xargs --no-run-if-empty docker rmi
echo "Success"
41 changes: 29 additions & 12 deletions cicd/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use_query_passage_prefixes=${USE_QUERY_PASSAGE_PREFIXES:-false}
use_query_prompt=${USE_QUERY_PROMPT:-false}
original_model_name=$model_name
git_tag=$GITHUB_REF_NAME
use_hf_auth_token=${USE_HF_AUTH_TOKEN:-false}

function main() {
init
Expand Down Expand Up @@ -48,18 +49,34 @@ function push_tag() {
tag="$remote_repo:$model_name_part"

echo "Tag & Push $tag, $tag_latest, $tag_git"
docker buildx build --platform=linux/arm64,linux/amd64 \
--build-arg "MODEL_NAME=$original_model_name" \
--build-arg "ONNX_RUNTIME=$onnx_runtime" \
--build-arg "TRUST_REMOTE_CODE=$trust_remote_code" \
--build-arg "USE_SENTENCE_TRANSFORMERS_VECTORIZER=$use_sentence_transformers_vectorizer" \
--build-arg "USE_QUERY_PASSAGE_PREFIXES=$use_query_passage_prefixes" \
--build-arg "USE_QUERY_PROMPT=$use_query_prompt" \
--push \
--tag "$tag_git" \
--tag "$tag_latest" \
--tag "$tag" \
.
if [ "$use_hf_auth_token" = "true" ]; then
DOCKER_BUILDKIT=1 docker buildx build -f auth.Dockerfile --platform=linux/arm64,linux/amd64 \
--secret id=hf_token,src=token.txt \
--build-arg "MODEL_NAME=$original_model_name" \
--build-arg "ONNX_RUNTIME=$onnx_runtime" \
--build-arg "TRUST_REMOTE_CODE=$trust_remote_code" \
--build-arg "USE_SENTENCE_TRANSFORMERS_VECTORIZER=$use_sentence_transformers_vectorizer" \
--build-arg "USE_QUERY_PASSAGE_PREFIXES=$use_query_passage_prefixes" \
--build-arg "USE_QUERY_PROMPT=$use_query_prompt" \
--push \
--tag "$tag_git" \
--tag "$tag_latest" \
--tag "$tag" \
.
else
docker buildx build --platform=linux/arm64,linux/amd64 \
--build-arg "MODEL_NAME=$original_model_name" \
--build-arg "ONNX_RUNTIME=$onnx_runtime" \
--build-arg "TRUST_REMOTE_CODE=$trust_remote_code" \
--build-arg "USE_SENTENCE_TRANSFORMERS_VECTORIZER=$use_sentence_transformers_vectorizer" \
--build-arg "USE_QUERY_PASSAGE_PREFIXES=$use_query_passage_prefixes" \
--build-arg "USE_QUERY_PROMPT=$use_query_prompt" \
--push \
--tag "$tag_git" \
--tag "$tag_latest" \
--tag "$tag" \
.
fi
fi
}

Expand Down
2 changes: 2 additions & 0 deletions cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ echo "Running tests without authorization"
container_id=$(docker run -d -it -p "8000:8080" "$local_repo")

python3 smoke_test.py

echo "All tests passed"
Loading