-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build the Docker image | ||
run: docker build . --tag 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:${{ github.run_id }} --tag 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:latest | ||
|
||
- name: configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: arn:aws:iam::256696114092:role/GithubDeploymentRole | ||
role-session-name: GithubSession | ||
aws-region: us-east-1 | ||
|
||
- name: Amazon ECR Login | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Push Docker images | ||
run: | | ||
docker image push 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:${{ github.run_id }} | ||
docker image push 256696114092.dkr.ecr.us-east-1.amazonaws.com/omniscope/app:latest | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: arn:aws:iam::256696114092:role/GithubDeploymentRole | ||
role-session-name: GithubSession | ||
aws-region: us-east-1 | ||
|
||
#TODO: Atualizar a task definition e o service | ||
- name: ECS Restart Service | ||
run: aws ecs update-service --cluster arn:aws:ecs:us-east-1:256696114092:cluster/fargate-spot-stack-ecscluster7830E7B5-5A2jZtnQeSlV --service omniscope-app --region us-east-1 --force-new-deployment | ||
|
||
# aws ecs update-service --cluster <nome_do_cluster> --service <nome_do_serviço> --force-new-deployment | ||
# - name: ECS Restart Service | ||
# uses: apideck-libraries/ecs-restart-service@v1 | ||
# with: | ||
# service: ominiscope-app | ||
# # The short name or full Amazon Resource Name (ARN) of the cluster that your service runs on. If you do not specify a cluster, the default cluster is assumed. | ||
# cluster: arn:aws:ecs:us-east-1:256696114092:cluster/fargate-spot-stack-ecscluster7830E7B5-5A2jZtnQeSlV | ||
|
||
|
||
|
||
|
||
|
||
|
||
|