-
Notifications
You must be signed in to change notification settings - Fork 7
54 lines (46 loc) · 1.45 KB
/
deploy.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
name: Build & Deploy API Container to ECR
on:
push:
branches: [ main ]
jobs:
build:
name: Build & Push API Container Image
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./services/api
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Where am I?
shell: bash
run: |
pwd
ls -la
- name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- 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-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build, tag, and push to ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
ECR_ALIAS: n7b1f4b4
ECR_REPOSITORY: private_llm_fastapi_server
IMAGE_TAG: latest
shell: bash
run: |
pwd
ls -la
docker build --build-arg="COMMITHASH=${{ env.sha_short }}" -t $ECR_REGISTRY/$ECR_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG