Skip to content

Commit 4bc3982

Browse files
authored
Merge pull request #28 from CERTCC/revision-registration
Initial attempt to add changes that will automate revision registration
2 parents d0a985d + 5a8a65b commit 4bc3982

3 files changed

Lines changed: 101 additions & 45 deletions

File tree

.github/workflows/build_containers.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/ecs-deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Deploy Containers
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
id-token: write
8+
contents: read
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
- name: Assume STS role
16+
uses: aws-actions/configure-aws-credentials@v4
17+
with:
18+
role-to-assume: ${{ vars.ARN }}
19+
aws-region: us-east-1
20+
role-session-name: github-actions
21+
- name: Login to Amazon ECR
22+
id: login-ecr
23+
uses: aws-actions/amazon-ecr-login@v2
24+
- name: Build and push FastAPI container
25+
id: build-fa
26+
env:
27+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
28+
IMAGE_TAG: ${{ github.sha }}
29+
run: |
30+
docker build -f Dockerfile-fa.yml \
31+
-t $REGISTRY/fa:$IMAGE_TAG \
32+
-t $REGISTRY/fa:latest .
33+
docker push $REGISTRY/fa:$IMAGE_TAG
34+
docker push $REGISTRY/fa:latest
35+
echo "image=$REGISTRY/fa:$IMAGE_TAG" >> $GITHUB_OUTPUT
36+
- name: Build and push Streamlit container
37+
id: build-sl
38+
env:
39+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
40+
IMAGE_TAG: ${{ github.sha }}
41+
run: |
42+
docker build -f Dockerfile-sl.yml \
43+
-t $REGISTRY/sl-image:$IMAGE_TAG \
44+
-t $REGISTRY/sl-image:latest .
45+
docker push $REGISTRY/sl-image:$IMAGE_TAG
46+
docker push $REGISTRY/sl-image:latest
47+
echo "image=$REGISTRY/sl-image:$IMAGE_TAG" >> $GITHUB_OUTPUT
48+
- name: Render FastAPI container
49+
id: render-fa
50+
uses: aws-actions/amazon-ecs-render-task-definition@v1
51+
with:
52+
task-definition: task-definition.json
53+
container-name: fa
54+
image: ${{ steps.build-fa.outputs.image }}
55+
- name: Render Streamlit container
56+
id: render-sl
57+
uses: aws-actions/amazon-ecs-render-task-definition@v1
58+
with:
59+
task-definition: ${{ steps.render-fa.outputs.task-definition }}
60+
container-name: sl
61+
image: ${{ steps.build-sl.outputs.image }}
62+
- name: Deploy to ECS
63+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
64+
with:
65+
task-definition: ${{ steps.render-sl.outputs.task-definition }}
66+
service: streamlit-service
67+
cluster: streamlit-cluster
68+
wait-for-service-stability: true
69+

task-definition.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"family": "streamlit-task",
3+
"networkMode": "awsvpc",
4+
"requiresCompatibilities": ["FARGATE"],
5+
"cpu": "512",
6+
"memory": "1024",
7+
"executionRoleArn": "ecsTaskExecutionRole",
8+
"containerDefinitions": [
9+
{
10+
"name": "fa",
11+
"image": "placeholder",
12+
"essential": true,
13+
"portMappings": [
14+
{
15+
"containerPort": 9000,
16+
"protocol": "tcp"
17+
}
18+
]
19+
},
20+
{
21+
"name": "sl",
22+
"image": "placeholder",
23+
"essential": true,
24+
"portMappings": [
25+
{
26+
"containerPort": 9001,
27+
"protocol": "tcp"
28+
}
29+
]
30+
}
31+
]
32+
}

0 commit comments

Comments
 (0)