Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions buildspec-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 0.2

phases:
install:
commands:
- echo Installing Node 21 e npm...
- curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash -
- sudo yum install -y nodejs
build:
commands:
- echo Instalando o NPM
- npm install --loglevel=error
- REACT_APP_API_URL=http://localhost:3001 SKIP_PREFLIGHT_CHECK=true npm run build --prefix client
- echo Rodando testes unitários da aplicação antes da etapa de Build
- npm test
6 changes: 3 additions & 3 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ phases:
pre_build:
commands:
- echo Fazendo login no ECR...
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 905418381762.dkr.ecr.us-east-1.amazonaws.com
- REPOSITORY_URI=905418381762.dkr.ecr.us-east-1.amazonaws.com/bia
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 108782099139.dkr.ecr.us-east-1.amazonaws.com
- REPOSITORY_URI=108782099139.dkr.ecr.us-east-1.amazonaws.com/bia
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
Expand All @@ -20,7 +20,7 @@ phases:
- echo Fazendo push da imagem para o ECR...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Gerando artefato da imagem para o ECS
- echo Gerando artefato da imagem para o repositório no ECS
- printf '[{"name":"bia","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ services:
container_name: bia
ports:
- 3001:8080
links:
- database
# links:
# - database
environment:
DB_USER: postgres
DB_PWD: postgres
Expand All @@ -24,16 +24,16 @@ services:
# timeout: 5s
# retries: 3
# start_period: 5s
database:
image: postgres:16.1
container_name: database
environment:
- "POSTGRES_USER=postgres"
- "POSTGRES_PASSWORD=postgres"
- "POSTGRES_DB=bia"
ports:
- 5433:5432
volumes:
- db:/var/lib/postgresql/data
# database:
# image: postgres:16.1
# container_name: database
# environment:
# - "POSTGRES_USER=postgres"
# - "POSTGRES_PASSWORD=postgres"
# - "POSTGRES_DB=bia"
# ports:
# - 5433:5432
# volumes:
# - db:/var/lib/postgresql/data
volumes:
db:
15 changes: 15 additions & 0 deletions pipeline/buildspec-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 0.2

phases:
install:
commands:
- echo Installing Node 21 e npm...
- curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash -
- sudo yum install -y nodejs
build:
commands:
- echo Instalando o NPM
- npm install --loglevel=error
- REACT_APP_API_URL=http://localhost:3001 SKIP_PREFLIGHT_CHECK=true npm run build --prefix client
- echo Rodando testes unitários da aplicação antes da etapa de Build
- npm test
26 changes: 26 additions & 0 deletions pipeline/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 0.2

phases:
pre_build:
commands:
- echo Fazendo login no ECR...
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 108782099139.dkr.ecr.us-east-1.amazonaws.com
- REPOSITORY_URI=108782099139.dkr.ecr.us-east-1.amazonaws.com/bia
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build iniciado em `date`
- echo Gerando imagem da BIA...
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build finalizado com sucesso em `date`
- echo Fazendo push da imagem para o ECR...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Gerando artefato da imagem para o repositório no ECS
- printf '[{"name":"bia","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json