Skip to content

Commit

Permalink
Optimized image size of torchvision grpc (kserve#2515)
Browse files Browse the repository at this point in the history
Moved the docker publish of transformer grpc into transformer workflow for optimization

Signed-off-by: Andrews Arokiam <[email protected]>

Signed-off-by: Andrews Arokiam <[email protected]>
  • Loading branch information
andyi2it authored Nov 11, 2022
1 parent 16df93f commit 29b7eec
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 78 deletions.
75 changes: 0 additions & 75 deletions .github/workflows/custom-transformer-grpc-publish.yml

This file was deleted.

62 changes: 61 additions & 1 deletion .github/workflows/transformer-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
IMAGE_NAME: image-transformer

GRPC_IMAGE_NAME: custom-image-transformer-grpc
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
Expand Down Expand Up @@ -73,3 +73,63 @@ jobs:
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test-transformer-grpc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file custom_transformer_grpc.Dockerfile
fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push-transformer-grpc:
# Ensure test job passes before pushing image.
needs: test

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: |
cd python
docker build . --file custom_transformer_grpc.Dockerfile --tag $GRPC_IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: |
IMAGE_ID=kserve/$GRPC_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $GRPC_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
4 changes: 2 additions & 2 deletions python/custom_model_grpc.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ COPY third_party third_party

COPY kserve kserve
COPY VERSION VERSION
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -e ./kserve && pip install --no-cache-dir torchvision

RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -e ./kserve
RUN pip install --no-cache-dir torch==1.13.0+cpu torchvision==0.14.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
COPY custom_model custom_model

RUN useradd kserve -m -u 1000 -d /home/kserve
Expand Down

0 comments on commit 29b7eec

Please sign in to comment.