forked from 00farhan00/Python-Flask-RestAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
30 lines (28 loc) · 1.12 KB
/
buildspec.yml
File metadata and controls
30 lines (28 loc) · 1.12 KB
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
version: 0.2
phases:
install:
runtime-versions:
python: 3.9
pre_build:
commands:
- echo Logging in to Amazon ECR...
- /root/.pyenv/versions/3.9.16/bin/python3.9 -m pip install --upgrade pip
- aws --version
- aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 468085339621.dkr.ecr.ap-south-1.amazonaws.com
- REPOSITORY_URI=468085339621.dkr.ecr.ap-south-1.amazonaws.com/ecs-python
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
build:
commands:
- pip install -r requirements.txt
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $REPOSITORY_URI:$IMAGE_TAG .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"ecs-python","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json #this represent the name of container
artifacts:
files: imagedefinitions.json