-
Notifications
You must be signed in to change notification settings - Fork 3
/
buildspec.yml
51 lines (45 loc) · 1.93 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
version: 0.2
phases:
install:
runtime-versions:
python: 3.8
commands:
- echo "Preparing building container"
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- echo "Installing requirements"
- pip install --upgrade pip
- pip install -r $CODEBUILD_SRC_DIR/requirements.txt
- pip install crhelper -t $CODEBUILD_SRC_DIR/custom_resource # Install custom resource helper into the CFN directory
pre_build:
commands:
- echo Pre-build started on `date`
- cd $CODEBUILD_SRC_DIR
- echo "Build and push container for Multi-Model-Endpoint"
- cd multi-model-endpoint/container
- ./build_and_push.sh
- cd $CODEBUILD_SRC_DIR
- echo "Build and push container for training"
- cd training/container
- ./build_and_push.sh
- echo Get pipeline name
- export PIPELINE_NAME=${CODEBUILD_INITIATOR#codepipeline/}
- echo $PIPELINE_NAME
build:
commands:
- echo Build started on `date`
- cd $CODEBUILD_SRC_DIR
- echo Run the workflow script
- python models/run.py --pipeline-name=$PIPELINE_NAME --model-name=$MODEL_NAME --stage=$STAGE --role=$ROLE_ARN --output-dir=assets --endpoint-dir=multi-model-endpoint --training-dir=training
post_build:
commands:
- echo Package custom resources
- aws cloudformation package --template-file custom_resource/sagemaker-custom-resource.yml --output-template-file assets/template-custom-resource.yml --s3-bucket $ARTIFACT_BUCKET
- echo Package endpoint deployment
- aws cloudformation package --template-file multi-model-endpoint/deploy-endpoint.yml --output-template-file assets/template-endpoint.yml --s3-bucket $ARTIFACT_BUCKET
- echo Done
artifacts:
files:
- assets/*.json
- assets/*.yml
discard-paths: yes