File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 0.2
2
+
3
+ env :
4
+ parameter-store :
5
+ DOCKER_HUB_USERNAME : " docker_hub_username"
6
+ DOCKER_HUB_PASSWORD : " docker_hub_password"
7
+ # store with: aws ssm put-parameter --name "docker_hub_username" --value "<username value>" --type String
8
+ phases :
9
+ install :
10
+ commands :
11
+ - export IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
12
+ - export ACCOUNT=$(echo $CODEBUILD_BUILD_ARN |cut -f5 -d:)
13
+ - export PROJECT_NAME=$(echo $CODEBUILD_BUILD_ID |sed -e 's/.*pipeline-\(.*\)-artifact.*/\1/'
14
+ - export IMAGE_REPO_NAME="${docker_hub_username}/$PROJECT_NAME"
15
+ ecsdemo-frontend)
16
+ - echo '***** This is the current env:'
17
+ - printenv
18
+ pre_build :
19
+ commands :
20
+ - echo Logging in to Docker Hub...
21
+ - docker login -u ${docker_hub_username} -p ${docker_hub_password}
22
+ build :
23
+ commands :
24
+ - echo Build started on `date`
25
+ - echo Building the Docker image...
26
+ - echo $IMAGE_TAG > code_hash.txt
27
+ - docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .
28
+ # - docker build -t myimage .
29
+ post_build :
30
+ commands :
31
+ - printf '[{"name":"example-backend","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
32
+ - echo Build completed on `date`
33
+ - echo Pushing the Docker image...
34
+ - docker push $IMAGE_REPO_NAME:$IMAGE_TAG
35
+ # - docker pull anchore/cli
36
+ # - docker run -d -v $(pwd):/source-dir -v /var/run/docker.sock:/var/run/docker.sock --name anchore anchore/cli:latest
37
+ # - docker exec anchore anchore feeds sync
38
+ # - docker exec anchore anchore analyze --image myimage --dockerfile /source-dir/Dockerfile
39
+
40
+ artifacts :
41
+ files :
42
+ - ' **/*'
You can’t perform that action at this time.
0 commit comments