Skip to content

Create powerai-based dockerfile, powerai builds for x86/ppc #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,46 @@ python:
- 3.6
services:
- docker
before_install:
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then
VERSION=latest;
else
VERSION=$TRAVIS_BRANCH;
fi
install:
- docker build -t max-image-resolution-enhancer .
- docker run -it -d --rm -p 5000:5000 max-image-resolution-enhancer
- docker build -f "$DOCKERFILE" -t codait/max-image-resolution-enhancer:"$IMAGE"-"$ARCH"-"$VERSION" .
- docker run -it --rm -d -p 5000:5000 codait/max-image-resolution-enhancer:"$IMAGE"-"$ARCH"-"$VERSION"
- pip install pytest requests flake8 Pillow
before_script:
- flake8 . --max-line-length=127
- sleep 30
script:
- flake8 . --max-line-length=127
- pytest tests/test.py
- 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-image-resolution-enhancer:"$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-image-resolution-enhancer:powerai-ppc64le-"$VERSION";
- docker pull codait/max-image-resolution-enhancer:powerai-x86_64-"$VERSION";
- docker manifest create codait/max-image-resolution-enhancer:powerai-"$VERSION" codait/max-image-resolution-enhancer:powerai-ppc64le-"$VERSION" codait/max-image-resolution-enhancer:powerai-x86_64-"$VERSION";
- docker manifest push codait/max-image-resolution-enhancer:powerai-"$VERSION"
21 changes: 21 additions & 0 deletions Dockerfile.pai
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM codait/max-base:powerai-latest

ARG model_bucket=https://s3.us-south.cloud-object-storage.appdomain.cloud/max-assets-prod/max-image-resolution-enhancer/1.0.0
ARG model_file=assets.tar.gz

WORKDIR /workspace

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 requirements-pai.txt /workspace
RUN ["/bin/bash", "-c", "cd /opt/anaconda3/bin && source activate base && while read requirement; do conda install --yes $requirement; done < /workspace/requirements-pai.txt"]

RUN ["/bin/bash", "-c", "cd /opt/anaconda3/bin && source activate base && IBM_POWERAI_LICENSE_ACCEPT=yes ./accept-powerai-license.sh" ]

COPY . /workspace
RUN md5sum -c md5sums.txt # check file integrity
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RUN md5sum -c md5sums.txt # check file integrity
# check file integrity
RUN md5sum -c md5sums.txt

https://docs.docker.com/engine/reference/builder/

Docker treats lines that begin with # as a comment, unless the line is a valid parser directive. A # marker anywhere else in a line is treated as an argument. This allows statements like:


EXPOSE 5000

CMD ["/bin/bash", "-c", "source /opt/anaconda3/bin/activate base && python3 app.py" ]
4 changes: 4 additions & 0 deletions requirements-pai.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Pillow
tensorflow
scikit-image
imageio