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

build: change custom build scripts to build production image #15

Open
wants to merge 12 commits into
base: torchserve-23mt-v0.8.0
Choose a base branch
from
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ RUN export USE_CUDA=1

ARG CUDA_VERSION=""

# Note: This is **only** used to install dependencies in this image - changing it will not build a custom image
RUN git clone --depth 1 https://github.com/pytorch/serve.git

WORKDIR "serve"
Expand Down
16 changes: 12 additions & 4 deletions docker/build_custom_images.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#!/bin/sh

# build 23mt-cpu
./build_image.sh -bt dev -b torchserve-23mt -t textshuttle/pytorch-serve:23mt-cpu
# increment when appropriate
VERSION=3

# build 23mt-gpu
./build_image.sh -bt dev -g -cv cu113 -b torchserve-23mt -t textshuttle/pytorch-serve:23mt-gpu
# these need to be -bt dev, otherwise the pip torchserve version will be installed

# build cpu
./build_image.sh -bt dev -b torchserve-23mt-v0.8.0 -t textshuttle/pytorch-serve:torchserve-23mt-v0.8.0-v${VERSION}-cpu

# build gpu
./build_image.sh -bt dev -b torchserve-23mt-v0.8.0 -g -cv cu118 -t textshuttle/pytorch-serve:torchserve-23mt-v0.8.0-v${VERSION}-gpu

# note that this will build arm/amd images depending on your OS
# for multi-platform building and tagging, see https://github.com/textshuttle/pytorch-serve/pull/15#issuecomment-1906360733
6 changes: 3 additions & 3 deletions docker/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -o errexit -o nounset -o pipefail

MACHINE=cpu
BRANCH_NAME="master"
DOCKER_TAG="pytorch/torchserve:latest-cpu"
BUILD_TYPE="production"
BRANCH_NAME=""
DOCKER_TAG=""
BUILD_TYPE=""
BASE_IMAGE="ubuntu:20.04"
USE_CUSTOM_TAG=false
CUDA_VERSION=""
Expand Down
5 changes: 1 addition & 4 deletions requirements/torch_cu118_linux.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
--extra-index-url https://download.pytorch.org/whl/cu118
-r torch_common.txt
torch==2.0.1+cu118; sys_platform == 'linux'
torchvision==0.15.2+cu118; sys_platform == 'linux'
torchtext==0.15.2; sys_platform == 'linux'
torchaudio==2.0.2+cu118; sys_platform == 'linux'
torch==2.1.0+cu118; sys_platform == 'linux'
5 changes: 1 addition & 4 deletions requirements/torch_linux.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
--extra-index-url https://download.pytorch.org/whl/cpu
-r torch_common.txt
torch==2.0.1+cpu; sys_platform == 'linux'
torchvision==0.15.2+cpu; sys_platform == 'linux'
torchtext==0.15.2; sys_platform == 'linux'
torchaudio==2.0.2+cpu; sys_platform == 'linux'
torch==2.1.0+cpu; sys_platform == 'linux'