Merge pull request #10 from cyber-evangelists/dependabot/pip/transfor… #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CAPEC Rag Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install sshpass | |
run: sudo apt-get install -y sshpass | |
- name: Setup SSH key for authentication | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DEV_KEY_PEM }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Add VM to known_hosts | |
run: | | |
ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts | |
- name: Verify known_hosts Entry | |
run: | | |
cat ~/.ssh/known_hosts # Optional step to confirm the host is added | |
- name: Synchronize Code with VM Using rsync and SSH key | |
run: | | |
rsync -avz --exclude='.git' --exclude='.env' --exclude='capec-dataset' \ | |
--exclude='src/embedder/embedding_model' --exclude='src/index/index' \ | |
--exclude='src/reranker/re_ranker_model' --no-perms --omit-dir-times --no-group \ | |
-e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa" ./ ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/home/dev/CAPEC-Rag/ | |
- name: Restart Docker Compose Services | |
uses: appleboy/ssh-action@v0.1.6 | |
with: | |
host: ${{ secrets.VM_HOST }} | |
username: ${{ secrets.VM_USER }} | |
key: ${{ secrets.DEV_KEY_PEM }} | |
timeout: 2h | |
script: | | |
echo "Stopping existing Docker Compose services..." | |
cd /home/dev/CAPEC-Rag/ | |
echo "${{ secrets.DEV_PASS }}" | sudo -S docker-compose down | |
echo "Starting Docker Compose services..." | |
echo "Enabling Docker BuildKit..." | |
export DOCKER_BUILDKIT=1 | |
echo "Starting Docker Compose services..." | |
echo "${{ secrets.DEV_PASS }}" | sudo -S docker-compose build --no-cache | |
echo "${{ secrets.DEV_PASS }}" | sudo -S docker-compose up -d | |
echo "Successfully deployed the application!" |