From 08eeb98629689ad2aa902a6c8915bca09bca02c8 Mon Sep 17 00:00:00 2001 From: Reza Rahemtola Date: Sun, 1 Dec 2024 05:14:23 +0900 Subject: [PATCH] feat(deployment): Cleaner default script --- deployment/deploy.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/deployment/deploy.sh b/deployment/deploy.sh index 4cc6535..90eba06 100644 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -1,17 +1,26 @@ #!/bin/bash +ZIP_PATH="/tmp/libertai-agent.zip" +CODE_PATH="/root/libertai-agent" +DOCKERFILE_PATH="/tmp/libertai-agent.Dockerfile" + # Setup apt install docker.io unzip -y # Cleaning previous agent -rm -rf /root/libertai-agent +rm -rf $CODE_PATH docker stop libertai-agent && docker rm $_ # Deploying the new agent -unzip /tmp/libertai-agent.zip -d /root/libertai-agent -wget https://raw.githubusercontent.com/Libertai/libertai-agents/refs/heads/reza/deployment-instances/deployment/$2.Dockerfile -O /tmp/libertai-agent.Dockerfile -q -docker build /root/libertai-agent \ - -f /tmp/libertai-agent.Dockerfile \ +unzip $ZIP_PATH -d $CODE_PATH +wget https://raw.githubusercontent.com/Libertai/libertai-agents/refs/heads/reza/deployment-instances/deployment/$2.Dockerfile -O $DOCKERFILE_PATH -q +docker build $CODE_PATH \ + -f $DOCKERFILE_PATH \ -t libertai-agent \ --build-arg PYTHON_VERSION=$1 docker run --name libertai-agent -p 8000:8000 -d libertai-agent + +# Cleanup +rm -f $ZIP_PATH +# rm -rf $CODE_PATH +rm -f $DOCKERFILE_PATH