-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (75 loc) · 3.25 KB
/
cf-ai-agent.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Build and Push Docker Image to AWS ECR
on:
pull_request:
branches:
- main
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max-old-space-size=8182
AWS_REGION: us-east-1 # Change this to the AWS region where your ECR repository is located
ECR_REPOSITORY: cf_analysis_agent # Replace this with your ECR repository name
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: v2-api
IMAGE_TAG: ${{ github.sha }}
run: |
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: Create .env File
working-directory: dodao-ui/dodao-ai-agents/crowd-fund-analysis
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, 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: |
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: 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