Skip to content
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

Add support for building docker images with specified python version #2154

Merged
merged 3 commits into from
Feb 23, 2023

Conversation

agunapal
Copy link
Collaborator

@agunapal agunapal commented Feb 23, 2023

Description

Build docker images based on the specified python version

  • Introduced an argument called -py for docker's build.sh
  • Supported python versions are 3.8, 3.9 and 3.10
  • Changed default Python version to 3.9

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • Dev Docker Image with 3.10
 => [compile-image 3/3] RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1     && update-alternatives --install /usr/local/bin/pip pip /usr/l  0.4s
 => [dev-image 1/2] RUN if [ "cpu" = "gpu" ]; then export USE_CUDA=1; fi     && git clone https://github.com/pytorch/serve.git     && cd serve     && git checkout maste  50.1s 
 => => #   Downloading numpy-1.24.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)                                                                        
 => => #      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 103.4 MB/s eta 0:00:00                                                                                       
 => => # Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from torchvision==0.14.1+cpu->-r requirements/torch_linux.txt (line 7)) (2.22.0)            
 => => # Collecting tqdm                                                                                                                                                        
 => => #   Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)                                                                                                                
 => => #      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 kB 19.0 MB/s eta 0:00:00    
  • Default Docker image
 => CACHED [runtime-image 2/9] RUN --mount=type=cache,target=/var/cache/apt     apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recomme  0.0s
 => CACHED [runtime-image 3/9] RUN useradd -m model-server     && mkdir -p /home/model-server/tmp                                                                          0.0s
 => CACHED [compile-image 2/8] RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt     apt-get update &&     apt-get upgrade -y &&     apt-get install software-prope  0.0s
 => CACHED [compile-image 3/8] RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1     && update-alternatives --install /usr/local/bin/pip pip   0.0s
 => CACHED [compile-image 4/8] RUN python$PYHON_VERSION -m venv /home/venv                                                                                                 0.0s
 => CACHED [compile-image 5/8] RUN python -m pip install -U pip setuptools                                                                                                 0.0s
 => CACHED [compile-image 6/8] RUN export USE_CUDA=1                                                                                                                       0.0s
 => [compile-image 7/8] RUN TORCH_VER=$(curl --silent --location https://pypi.org/pypi/torch/json | python -c "import sys, json, pkg_resources; releases = json.load(sys.  6.3s
 => => # Collecting pillow!=8.3.*,>=5.3.0                                                                                                                                      
 => => #   Downloading Pillow-9.4.0-cp39-cp39-manylinux_2_28_x86_64.whl (3.4 MB)                                                                                               
 => => #      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 84.2 MB/s eta 0:00:00                                                                                        
 => => # Collecting requests                                                                                                                                                   
 => => #   Downloading requests-2.28.2-py3-none-any.whl (62 kB)                                                            

Checklist:

  • Did you have fun?
  • Have you added tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

Copy link
Member

@msaroufim msaroufim left a comment

Choose a reason for hiding this comment

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

Assuming all CI is green LGTM

@goha11 as FYI

docker/build_image.sh Outdated Show resolved Hide resolved
docker/build_image.sh Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Merging #2154 (3284576) into master (b8f52d8) will not change coverage.
The diff coverage is n/a.

❗ Current head 3284576 differs from pull request most recent head 475b8e4. Consider uploading reports for the commit 475b8e4 to get more accurate results

@@           Coverage Diff           @@
##           master    #2154   +/-   ##
=======================================
  Coverage   53.36%   53.36%           
=======================================
  Files          71       71           
  Lines        3225     3225           
  Branches       56       56           
=======================================
  Hits         1721     1721           
  Misses       1504     1504           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lxning lxning merged commit 26089d4 into master Feb 23, 2023
simonschoelly pushed a commit to textshuttle/pytorch-serve that referenced this pull request May 29, 2023
…ytorch#2154)

* Changes to support different python versions

* Updated default version to 3.9

* spellcheck lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants