Skip to content

Commit 200833e

Browse files
committed
add github action workflows
1 parent 7bc12ce commit 200833e

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/backend-ecs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: meritpath-backend-service Deploy to Amazon ECS
1+
name: Backend Service Deploy to Amazon ECS
22

33
on:
44
push:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Browser Service Deploy to Amazon ECS
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'visual-tree-search-browser-service/**'
8+
workflow_dispatch:
9+
10+
env:
11+
AWS_REGION: us-east-1
12+
ECR_REPOSITORY: visual-tree-search-browser-service
13+
ECS_CLUSTER: fargate-cluster
14+
ECS_SERVICE: visual-tree-search-browser-service
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
deploy:
21+
name: Deploy to ECS
22+
runs-on: ubuntu-latest # Changed from arm64-latest to ubuntu-latest
23+
environment: production
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Configure AWS credentials
30+
uses: aws-actions/configure-aws-credentials@v1
31+
with:
32+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
33+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
34+
aws-region: ${{ env.AWS_REGION }}
35+
36+
- name: Login to Amazon ECR
37+
id: login-ecr
38+
uses: aws-actions/amazon-ecr-login@v1
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v2
42+
43+
- name: Build, tag, and push image to Amazon ECR
44+
env:
45+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
46+
run: |
47+
# Build a docker container for ARM64 and push it to ECR
48+
docker buildx build --platform linux/arm64 \
49+
--tag $ECR_REGISTRY/$ECR_REPOSITORY:latest \
50+
--push ./visual-tree-search-browser-service
51+
52+
- name: Force new deployment of ECS service
53+
run: |
54+
aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --force-new-deployment

0 commit comments

Comments
 (0)