Skip to content

Increased EC2 instance volume from 10 to 30GB #2

Increased EC2 instance volume from 10 to 30GB

Increased EC2 instance volume from 10 to 30GB #2

Workflow file for this run

# Workflow name
name: DocQuery CI/CD Pipeline
# Event Trigger
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'LICENSE'
# Permissions
permissions:
id-token: write
contents: read
# Jobs
jobs:
# Continuous Integration
integration:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Lint Code
run: echo "Linting repository"
- name: Run unit tests
run: echo "Running unit tests"
# Continuous Delivery
build-and-push-ecr-image:
name: Continuous Delivery
needs: integration
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Utilities
run: |
sudo apt-get update -y
sudo apt-get install -y jq unzip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }}
IMAGE_TAG: latest
run: |
# Build docker container and push it to ECR
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
# Continuous Deployment
continuous-deployment:
needs: build-and-push-ecr-image
runs-on: self-hosted
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Pull latest image
run: |
docker pull ${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
- name: Stop and remove old container
run: |
docker stop docquery-rag || true
docker rm docquery-rag || true
- name: Run docker image with persistent volumes
run: |
docker run -d -p 8000:8000 --name=docquery-rag \
--restart=unless-stopped \
-e GROQ_API_KEY=${{ secrets.GROQ_API_KEY }} \
-v /home/ubuntu/docquery_data/vector_store:/app/data/vector_store \
-v /home/ubuntu/docquery_data/pdf_files:/app/data/pdf_files:ro \
${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
- name: Clean previous images and containers
run: |
docker system prune -f