Skip to content

Commit

Permalink
Combine build tag and push
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinNagpal committed Jan 16, 2025
1 parent 19a1599 commit 3ae2a53
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions .github/workflows/cf-ai-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,45 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# - name: Log in to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
#
# - name: Configure AWS CLI
# run: |
# aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws configure set default.region us-east-1
#
# - name: Create .env File
# run: |
# cat <<EOF > cf_analysis_agent/.env
# OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# SCRAPINGANT_API_KEY=${{ secrets.SCRAPINGANT_API_KEY }}
# SERPER_API_KEY=${{ secrets.SERPER_API_KEY }}
# SCRAPIN_API_KEY=${{ secrets.SCRAPIN_API_KEY }}
# GOOGLE_CSE_ID=${{ secrets.GOOGLE_CSE_ID }}
# GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}
# EOF
- name: Build Docker Image
- name: Create .env File
working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
run: |
docker build -t cf_analysis_agent:latest .
cat <<EOF > cf_analysis_agent/.env
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
SCRAPINGANT_API_KEY=${{ secrets.SCRAPINGANT_API_KEY }}
SERPER_API_KEY=${{ secrets.SERPER_API_KEY }}
SCRAPIN_API_KEY=${{ secrets.SCRAPIN_API_KEY }}
GOOGLE_CSE_ID=${{ secrets.GOOGLE_CSE_ID }}
GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}
EOF
- name: Tag Docker Image
- name: Build, tag, and push image to Amazon ECR
working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: v2-api
IMAGE_TAG: ${{ github.sha }}
run: |
IMAGE_URI=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/cf_analysis_agent:latest
docker tag cf_analysis_agent:latest $IMAGE_URI
echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_ENV
aws sts get-caller-identity
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Push Docker Image to ECR
run: |
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/cf_analysis_agent:latest
# - name: Build Docker Image
# working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
# run: |
# docker build -t cf_analysis_agent:latest .
#
# - name: Tag Docker Image
# working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
# run: |
# IMAGE_URI=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/cf_analysis_agent:latest
# docker tag cf_analysis_agent:latest $IMAGE_URI
# echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_ENV
#
# - name: Push Docker Image to ECR
# working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
# run: |
# docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/cf_analysis_agent:latest

0 comments on commit 3ae2a53

Please sign in to comment.