-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec_docker.yml
36 lines (33 loc) · 1.19 KB
/
buildspec_docker.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
version: 0.2
phases:
install:
runtime-versions:
python: latest
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $IMAGE_REPO_URI
build:
commands:
- cd ./my-app
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t myapp:$IMAGE_TAG .
- docker tag myapp:$IMAGE_TAG $IMAGE_REPO_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $IMAGE_REPO_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"my-app","imageUri":"%s"}]' $IMAGE_REPO_URI:$IMAGE_TAG > $CODEBUILD_SRC_DIR/imagedefinitions.json
- printf '{"ImageURI":"%s"}' $IMAGE_REPO_URI:$IMAGE_TAG > $CODEBUILD_SRC_DIR/imageDetail.json
artifacts:
files:
- imagedefinitions.json
- imageDetail.json
- appspec.yaml
- taskdef.json
# Read more about `imagedefinitions.json` and `imageDetail.json`
# Image definitions file reference
# https://docs.aws.amazon.com/codepipeline/latest/userguide/file-reference.html