From 5e0aff069d6266054ee3b2d42dbc17546eafecce Mon Sep 17 00:00:00 2001 From: Matthew Borgard Date: Wed, 4 Sep 2019 16:23:40 -0500 Subject: [PATCH 1/4] Add initial powerai-based dockerfile --- Dockerfile.pai | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile.pai diff --git a/Dockerfile.pai b/Dockerfile.pai new file mode 100644 index 0000000..19b0484 --- /dev/null +++ b/Dockerfile.pai @@ -0,0 +1,20 @@ +FROM codait/max-base:powerai-v1.2.1 + +RUN ["/bin/bash", "-c", "cd /opt/anaconda3/bin && source activate base && conda install -y tensorflow" ] + +ARG model_bucket=https://s3.us-south.cloud-object-storage.appdomain.cloud/max-assets-prod/max-audio-sample-generator/1.0.0 +ARG model_file=assets.tar.gz + +RUN ["/bin/bash", "-c", "cd /opt/anaconda3/bin && source activate base && IBM_POWERAI_LICENSE_ACCEPT=yes ./accept-powerai-license.sh" ] + +WORKDIR /workspace + +RUN wget -nv --show-progress --progress=bar:force:noscroll ${model_bucket}/${model_file} --output-document=assets/${model_file} +RUN tar -x -C assets/ -f assets/${model_file} -v && rm assets/${model_file} + +COPY . /workspace +RUN md5sum -c md5sums.txt # check file integrity + +EXPOSE 5000 + +CMD ["/bin/bash", "-c", "source /opt/anaconda3/bin/activate base && python3 app.py" ] From 6748fdcb6b247d3e3efe88b0cbb8d04dc61f786f Mon Sep 17 00:00:00 2001 From: Matthew Borgard Date: Wed, 4 Sep 2019 20:00:17 -0500 Subject: [PATCH 2/4] Add powerai builds to travis.yml --- .travis.yml | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c8cf26d..105587e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -# # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,19 +11,52 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# language: python python: - 3.6 services: - docker +before_install: + - if [[ "$TRAVIS_BRANCH" == "master" ]]; then + VERSION=latest; + else + VERSION=$TRAVIS_BRANCH; + fi install: - - docker build -t max-audio-sample-generator . - - docker run -it -d -p 5000:5000 max-audio-sample-generator + - docker build -f "$DOCKERFILE" -t codait/max-audio-sample-generator:"$IMAGE"-"$ARCH"-"$VERSION" . + - docker run -it --rm -d -p 5000:5000 codait/max-audio-sample-generator:"$IMAGE"-"$ARCH"-"$VERSION" - pip install pytest requests scipy numpy flake8 before_script: - flake8 . --max-line-length=127 - sleep 30 script: - pytest tests/test.py +after_success: + - if [[ "$IMAGE" != "test" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then + echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin; + docker push codait/max-audio-sample-generator:"$IMAGE"-"$ARCH"-"$VERSION"; + fi + +matrix: + include: + - os: linux + env: DOCKERFILE=Dockerfile IMAGE=test ARCH=x86_64 + - os: linux + env: DOCKERFILE=Dockerfile.pai IMAGE=powerai ARCH=x86_64 + - os: linux-ppc64le + env: DOCKERFILE=Dockerfile.pai IMAGE=powerai ARCH=ppc64le + - if: type = push AND (branch = master OR tag IS present) + stage: "Docker Manifest" + addons: + apt: + packages: + - docker-ce + install: + before_script: + script: + - export DOCKER_CLI_EXPERIMENTAL=enabled + - docker pull codait/max-audio-sample-generator:powerai-ppc64le-"$VERSION"; + - docker pull codait/max-audio-sample-generator:powerai-x86_64-"$VERSION"; + - docker manifest create codait/max-audio-sample-generator:powerai-"$VERSION" codait/max-audio-sample-generator:powerai-ppc64le-"$VERSION" codait/max-audio-sample-generator:powerai-x86_64-"$VERSION"; + - docker manifest push codait/max-audio-sample-generator:powerai-"$VERSION" From ccf1edba783b0f05df0562852757eed9ddff81d3 Mon Sep 17 00:00:00 2001 From: Matthew Borgard Date: Thu, 5 Sep 2019 08:35:42 -0500 Subject: [PATCH 3/4] Patch up travis/dockerfile --- .travis.yml | 7 ++++--- Dockerfile.pai | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 105587e..e17c830 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_script: script: - pytest tests/test.py after_success: - - if [[ "$IMAGE" != "test" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then + - if [[ "$IMAGE" != "pipTestOnly" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin; docker push codait/max-audio-sample-generator:"$IMAGE"-"$ARCH"-"$VERSION"; fi @@ -41,7 +41,7 @@ after_success: matrix: include: - os: linux - env: DOCKERFILE=Dockerfile IMAGE=test ARCH=x86_64 + env: DOCKERFILE=Dockerfile IMAGE=pipTestOnly ARCH=x86_64 - os: linux env: DOCKERFILE=Dockerfile.pai IMAGE=powerai ARCH=x86_64 - os: linux-ppc64le @@ -56,7 +56,8 @@ matrix: before_script: script: - export DOCKER_CLI_EXPERIMENTAL=enabled + - echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin; - docker pull codait/max-audio-sample-generator:powerai-ppc64le-"$VERSION"; - docker pull codait/max-audio-sample-generator:powerai-x86_64-"$VERSION"; - docker manifest create codait/max-audio-sample-generator:powerai-"$VERSION" codait/max-audio-sample-generator:powerai-ppc64le-"$VERSION" codait/max-audio-sample-generator:powerai-x86_64-"$VERSION"; - - docker manifest push codait/max-audio-sample-generator:powerai-"$VERSION" + - docker manifest push codait/max-audio-sample-generator:powerai-"$VERSION"; diff --git a/Dockerfile.pai b/Dockerfile.pai index 19b0484..8272c19 100644 --- a/Dockerfile.pai +++ b/Dockerfile.pai @@ -9,11 +9,13 @@ RUN ["/bin/bash", "-c", "cd /opt/anaconda3/bin && source activate base && IBM_PO WORKDIR /workspace -RUN wget -nv --show-progress --progress=bar:force:noscroll ${model_bucket}/${model_file} --output-document=assets/${model_file} -RUN tar -x -C assets/ -f assets/${model_file} -v && rm assets/${model_file} +RUN wget -nv --show-progress --progress=bar:force:noscroll ${model_bucket}/${model_file} --output-document=assets/${model_file} && \ + tar -x -C assets/ -f assets/${model_file} -v && rm assets/${model_file} -COPY . /workspace -RUN md5sum -c md5sums.txt # check file integrity +COPY . . + +# check file integrity +RUN md5sum -c md5sums.txt EXPOSE 5000 From d9952006f185e7e72679612acd047a3cea8580df Mon Sep 17 00:00:00 2001 From: Matthew Borgard Date: Thu, 5 Sep 2019 12:46:34 -0500 Subject: [PATCH 4/4] Change vanilla image label --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e17c830..ca11a1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_script: script: - pytest tests/test.py after_success: - - if [[ "$IMAGE" != "pipTestOnly" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then + - if [[ "$IMAGE" != "vanilla" && "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]]; then echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin; docker push codait/max-audio-sample-generator:"$IMAGE"-"$ARCH"-"$VERSION"; fi @@ -41,7 +41,7 @@ after_success: matrix: include: - os: linux - env: DOCKERFILE=Dockerfile IMAGE=pipTestOnly ARCH=x86_64 + env: DOCKERFILE=Dockerfile IMAGE=vanilla ARCH=x86_64 - os: linux env: DOCKERFILE=Dockerfile.pai IMAGE=powerai ARCH=x86_64 - os: linux-ppc64le