-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuildspec.yml
41 lines (37 loc) · 1.12 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
version: 0.2
env:
shell: bash
variables:
DOCKER_FILE_NAME: 'Dockerfile'
CONTAINER_TO_RELEASE_NAME: 'classifier'
REPOSITORY_URI: 'provided-by-server-environment'
phases:
install:
runtime-versions:
python: 3.8
pre_build:
commands:
- TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)"
- echo Target Docker image tag - $TAG
- $(aws ecr get-login --no-include-email)
- IMAGE_URI="${REPOSITORY_URI}:${TAG}"
- echo Target Docker image URI - $IMAGE_URI
build:
commands:
- echo "Starting Docker build `date` in `pwd`"
- docker build -t $IMAGE_URI -f $DOCKER_FILE_NAME .
- docker run --entrypoint="./run_tests.sh" $IMAGE_URI
- docker tag $IMAGE_URI $REPOSITORY_URI:latest
post_build:
commands:
- echo "Pushing to image uri $IMAGE_URI"
- docker push "$IMAGE_URI"
- printf '[{"name":"%s","imageUri":"%s"}]' "$CONTAINER_TO_RELEASE_NAME" "$IMAGE_URI" > imagedefinitions.json
- echo "--------BUILD DONE.--------"
artifacts:
files:
- 'imagedefinitions.json'
discard-paths: 'yes'
cache:
paths:
- '/root/.cache/pip'