-
Notifications
You must be signed in to change notification settings - Fork 855
Support Alpine-based docker base image #822
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
Conversation
* make sagemaker docker image have same file structure * use consistent file names * move operator code out of __init__ to avoid loading unused code in model server startup * refactor deployment validator * reorganize bento repository code * deployment valiator test&linting error fix * more repository code cleanup * renaming and adding inline comments * move out lambda operator code to separate file
Hi @jackyzha0, just adding some context here: In the default docker base image, we use conda to ensure the python version matches the saved bundle's python version(from what python version the bundle is created). The python version can be found in the bentoml.yml file under the saved bundle directory, as well as the environments.yml(conda environment config file). Besides installing the right python version, conda does make installing some packages a lot easier, (e.g. H2O for example) and some companies might be already using conda for dependency management. Although with bentoml, It is possible to use a docker base image without conda installed, it will just ignore the environment.yml. And in that case, if the user has specified conda dependencies with their BentoService class, those dependencies will not be installed. With Alpine based docker image, I think there are two approaches here:
There might be other ways to do it, let me know if you'd like to discuss more. |
Heyo @parano, Thanks for the context! That does make a lot more sense. I actually did try the first approach, but ran into a lot of issues installing wheels as they are built for I think option 2 will be the best way to go about doing it and just build Alpine versions for every major Python release. I was planning on writing up some more docs for this today. Anything major you'd like me to include? |
docs/source/concepts.rst
Outdated
pip_dependencies=['pandas'], | ||
conda_channels=['h2oai'], | ||
conda_dependencies=['h2o==3.24.0.2'], | ||
docker_base_image="bentoml/model-server:0.8.12-alpine3.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make sure this base image here in the example matches the name we have in the docker release script? bentoml/model-server:0.8.12-alpine3.7
?
I think you may also want to rename the docker file here to Dockerfile-alpine-py36
, Dockerfile-alpine-py37
.. and add them to the docker/model-server/release.sh
script.
We currently run that release script after every PyPI release, which pushes the new image to docker hub under, e.g. bentoml/model-server:0.8.2-alpine-py36
.
Codecov Report
@@ Coverage Diff @@
## master #822 +/- ##
=======================================
Coverage 56.41% 56.41%
=======================================
Files 116 116
Lines 8608 8609 +1
=======================================
+ Hits 4856 4857 +1
Misses 3752 3752
Continue to review full report at Codecov.
|
@parano Just added a section to |
-t bentoml/model-server:"$BENTOML_VERSION"-alpine \ | ||
PYTHON_MAJOR_VERSIONS=(3.6 3.7 3.8) | ||
echo "Building Alpine based docker base images for ${PYTHON_MAJOR_VERSIONS[*]}" | ||
for version in "${PYTHON_MAJOR_VERSIONS[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Could you rename the image tag from Otherwise, this looks great @jackyzha0! |
Thanks for updating the PR @jackyzha0! I will go ahead and run the release these docker images for 0.8.2 and do some more testing on my end! |
Just published alpine based images for 0.8.1 on docker-hub https://hub.docker.com/repository/docker/bentoml/model-server cc @bojiang - could you add a test case in the dockerized API server integration tests you are working on, to use alpine based docker image? |
* Repository and Deployment refactor and cleanup (bentoml#771) * make sagemaker docker image have same file structure * use consistent file names * move operator code out of __init__ to avoid loading unused code in model server startup * refactor deployment validator * reorganize bento repository code * deployment valiator test&linting error fix * more repository code cleanup * renaming and adding inline comments * move out lambda operator code to separate file * fixed dockerfile to use multi-stage builds * add some docs for alternative docker images * add bash script support for building multiple python versions * add more docs * update name of docker files to reflect naming conventions and fixed docs Co-authored-by: Chaoyu <paranoyang@gmail.com> Co-authored-by: cory <cory.massaro@gmail.com>
Description
Use of
venv
and multi-stage builds to shave cost of building dependencies.Motivation and Context
How Has This Been Tested?
@env(auto_pip_dependencies=True, docker_base_image="bentoml/model-server:0.8.12-alpine")
Types of changes
Components (if applicable)
Checklist:
./dev/format.sh
and./dev/lint.sh
script have passed(instructions).