-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildspec.yml
61 lines (60 loc) · 1.94 KB
/
buildspec.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
55
56
57
58
59
60
61
version: 0.2
phases:
install:
runtime-versions:
python: 3.11
commands:
- echo Installing dependencies...
- pip3 install -r requirements.txt
- mkdir test-reports
pre_build:
commands:
- echo Run tests
- pytest
--html=test-reports/report.html
--self-contained-html
-s
-v
--cov=src
--cov-fail-under=70
--cov-report=html:test-reports/coverage
--junitxml=test-reports/junit.xml
--log-file=test-reports/logs.txt
tests
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 887664210442.dkr.ecr.us-east-1.amazonaws.com
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t paas-microservice .
- docker tag paas-microservice:latest 887664210442.dkr.ecr.us-east-1.amazonaws.com/paas-microservice:latest
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push 887664210442.dkr.ecr.us-east-1.amazonaws.com/paas-microservice:latest
- echo Writing image definitions file...
- printf '[{"name":"paas-microservice","imageUri":"%s"}]' 887664210442.dkr.ecr.us-east-1.amazonaws.com/paas-microservice:latest > imagedefinitions.json
- echo Writing image details file used for deployment...
- printf '{"ImageURI":"%s"}' 887664210442.dkr.ecr.us-east-1.amazonaws.com/paas-microservice:latest > imageDetail.json
- cat imagedefinitions.json
reports:
junit:
files: "junit.xml"
base-directory: "test-reports"
file-format: JUNITXML
discard-paths: yes
artifacts:
files:
- "**/*"
- imagedefinitions.json
- imageDetail.json
secondary-artifacts:
DefinitionArtifact:
files:
- appspec.json
- taskdef.json
ImageArtifact:
files:
- imageDetail.json