|
| 1 | +version: 0.2 |
| 2 | + |
| 3 | +env: |
| 4 | + variables: |
| 5 | + FRAMEWORK_VERSION: "1.0-1" |
| 6 | + |
| 7 | +phases: |
| 8 | + install: |
| 9 | + runtime-versions: |
| 10 | + docker: 19 |
| 11 | + python: 3.8 |
| 12 | + pre_build: |
| 13 | + commands: |
| 14 | + - echo Logging in to Amazon ECR... |
| 15 | + - $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION) |
| 16 | + - echo Installing dependencies... |
| 17 | + - curl -LO https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-Linux-aarch64.sh |
| 18 | + - bash Miniconda3-py38_4.12.0-Linux-aarch64.sh -bfp /miniconda3 |
| 19 | + - export PATH=/miniconda3/bin:${PATH} |
| 20 | + - conda install python=3.8 |
| 21 | + - conda update -y conda |
| 22 | + - python3 -m pip install pip==20.1 # The new pip denpendency resolver in 20.2+ can't resolve 1.0-1 and 0.90 dependencies |
| 23 | + - python3 -m pip install .[test] |
| 24 | + build: |
| 25 | + commands: |
| 26 | + - echo Build started on `date` |
| 27 | + - echo Building the Docker image... |
| 28 | + - docker login -u $dockerhub_username -p $dockerhub_password |
| 29 | + - docker build -t sklearn-base:$FRAMEWORK_VERSION-cpu-py3-arm64 -f docker/$FRAMEWORK_VERSION/base/Dockerfile_arm.cpu . |
| 30 | + - pip install wheel setuptools |
| 31 | + - python setup.py bdist_wheel |
| 32 | + - docker build -t preprod-sklearn:$FRAMEWORK_VERSION-cpu-py3-arm64 -f docker/$FRAMEWORK_VERSION/final/Dockerfile_arm.cpu . |
| 33 | + - echo Running tox... |
| 34 | + - printf "FROM preprod-sklearn:$FRAMEWORK_VERSION-cpu-py3-arm64\nADD . /app\nWORKDIR /app\nRUN python3 -m pip install .[test]" > Dockerfile_arm.test |
| 35 | + - docker build -t test-sklearn -f Dockerfile_arm.test . |
| 36 | + - docker run --rm -t test-sklearn sh -c 'tox -e ALL' |
| 37 | + - echo Running container tests... |
| 38 | + - pytest test/integration --docker-base-name preprod-sklearn --tag $FRAMEWORK_VERSION-cpu-py3-arm64 --py-version 3 --framework-version $FRAMEWORK_VERSION |
| 39 | + - docker tag preprod-sklearn:$FRAMEWORK_VERSION-cpu-py3-arm64 515193369038.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn:$FRAMEWORK_VERSION-cpu-py3-arm64 |
| 40 | + post_build: |
| 41 | + commands: |
| 42 | + - echo Build completed on `date` |
| 43 | + - echo Pushing the Docker image... |
| 44 | + - docker push 515193369038.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn:$FRAMEWORK_VERSION-cpu-py3-arm64 |
0 commit comments