Skip to content

Commit

Permalink
Use buildkit for docker build (kserve#2848)
Browse files Browse the repository at this point in the history
Signed-off-by: Sivanantham Chinnaiyan <[email protected]>
  • Loading branch information
sivanantha321 authored Apr 28, 2023
1 parent 6aa4ae2 commit 852334b
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/agent-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file agent.Dockerfile
docker buildx build . --file agent.Dockerfile
fi
# Push image to GitHub Packages.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/alibiexplainer-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file alibiexplainer.Dockerfile
docker buildx build . --file alibiexplainer.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file alibiexplainer.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file alibiexplainer.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/artexplainer-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file artexplainer.Dockerfile
docker buildx build . --file artexplainer.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file artexplainer.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file artexplainer.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/custom-model-grpc-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file custom_model_grpc.Dockerfile
docker buildx build . --file custom_model_grpc.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file custom_model_grpc.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file custom_model_grpc.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kserve-controller-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
docker buildx build . --file Dockerfile
fi
# Push image to GitHub Packages.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lightgbm-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file lgb.Dockerfile
docker buildx build . --file lgb.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file lgb.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file lgb.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/paddle-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file paddle.Dockerfile
docker buildx build . --file paddle.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file paddle.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file paddle.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pmml-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file pmml.Dockerfile
docker buildx build . --file pmml.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file pmml.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file pmml.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qpext-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd qpext
docker build . --file qpext.Dockerfile
docker buildx build . --file qpext.Dockerfile
fi
# Push image to GitHub Packages.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/router-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file router.Dockerfile
docker buildx build . --file router.Dockerfile
fi
# Push image to GitHub Packages.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sklearnserver-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file sklearn.Dockerfile
docker buildx build . --file sklearn.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file sklearn.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file sklearn.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/storage-initializer-docker-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file storage-initializer.Dockerfile
docker buildx build . --file storage-initializer.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file storage-initializer.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file storage-initializer.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tf2openapi-docker-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file tools/tf2openapi/Dockerfile
docker buildx build . --file tools/tf2openapi/Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -48,7 +48,7 @@ jobs:

- name: Build image
run: |
docker build . --file tools/tf2openapi/Dockerfile --tag $IMAGE_NAME
docker buildx build . --file tools/tf2openapi/Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/transformer-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file custom_transformer.Dockerfile
docker buildx build . --file custom_transformer.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file custom_transformer.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file custom_transformer.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file custom_transformer_grpc.Dockerfile
docker buildx build . --file custom_transformer_grpc.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -106,7 +106,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file custom_transformer_grpc.Dockerfile --tag $GRPC_IMAGE_NAME
docker buildx 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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/xgbserver-docker-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
docker-compose --file docker-compose.test.yml run sut
else
cd python
docker build . --file xgb.Dockerfile
docker buildx build . --file xgb.Dockerfile
fi
# Push image to GitHub Packages.
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Build image
run: |
cd python
docker build . --file xgb.Dockerfile --tag $IMAGE_NAME
docker buildx build . --file xgb.Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ generate: controller-gen

# Build the docker image
docker-build: test
docker build . -t ${IMG}
docker buildx build . -t ${IMG}
@echo "updating kustomize image patch file for manager resource"

# Use perl instead of sed to avoid OSX/Linux compatibility issue:
Expand All @@ -212,10 +212,10 @@ docker-push:
docker push ${IMG}

docker-build-agent:
docker build -f agent.Dockerfile . -t ${KO_DOCKER_REPO}/${AGENT_IMG}
docker buildx build -f agent.Dockerfile . -t ${KO_DOCKER_REPO}/${AGENT_IMG}

docker-build-router:
docker build -f router.Dockerfile . -t ${KO_DOCKER_REPO}/${ROUTER_IMG}
docker buildx build -f router.Dockerfile . -t ${KO_DOCKER_REPO}/${ROUTER_IMG}

docker-push-agent:
docker push ${KO_DOCKER_REPO}/${AGENT_IMG}
Expand All @@ -224,85 +224,85 @@ docker-push-router:
docker push ${KO_DOCKER_REPO}/${ROUTER_IMG}

docker-build-sklearn:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${SKLEARN_IMG} -f sklearn.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${SKLEARN_IMG} -f sklearn.Dockerfile .

docker-push-sklearn: docker-build-sklearn
docker push ${KO_DOCKER_REPO}/${SKLEARN_IMG}

docker-build-xgb:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${XGB_IMG} -f xgb.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${XGB_IMG} -f xgb.Dockerfile .

docker-push-xgb: docker-build-xgb
docker push ${KO_DOCKER_REPO}/${XGB_IMG}

docker-build-lgb:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${LGB_IMG} -f lgb.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${LGB_IMG} -f lgb.Dockerfile .

docker-push-lgb: docker-build-lgb
docker push ${KO_DOCKER_REPO}/${LGB_IMG}

docker-build-pmml:
cd python && docker build --build-arg BASE_IMAGE=${PMML_BASE_IMG} -t ${KO_DOCKER_REPO}/${PMML_IMG} -f pmml.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${PMML_BASE_IMG} -t ${KO_DOCKER_REPO}/${PMML_IMG} -f pmml.Dockerfile .

docker-push-pmml: docker-build-pmml
docker push ${KO_DOCKER_REPO}/${PMML_IMG}

docker-build-paddle:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${PADDLE_IMG} -f paddle.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${PADDLE_IMG} -f paddle.Dockerfile .

docker-push-paddle: docker-build-paddle
docker push ${KO_DOCKER_REPO}/${PADDLE_IMG}

docker-build-custom-model:
cd python && docker build -t ${KO_DOCKER_REPO}/${CUSTOM_MODEL_IMG} -f custom_model.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${CUSTOM_MODEL_IMG} -f custom_model.Dockerfile .

docker-push-custom-model: docker-build-custom-model
docker push ${KO_DOCKER_REPO}/${CUSTOM_MODEL_IMG}

docker-build-custom-model-grpc:
cd python && docker build -t ${KO_DOCKER_REPO}/${CUSTOM_MODEL_GRPC_IMG} -f custom_model_grpc.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${CUSTOM_MODEL_GRPC_IMG} -f custom_model_grpc.Dockerfile .

docker-push-custom-model-grpc: docker-build-custom-model-grpc
docker push ${KO_DOCKER_REPO}/${CUSTOM_MODEL_GRPC_IMG}

docker-build-custom-transformer:
cd python && docker build -t ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_IMG} -f custom_transformer.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_IMG} -f custom_transformer.Dockerfile .

docker-push-custom-transformer: docker-build-custom-transformer
docker push ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_IMG}

docker-build-custom-transformer-grpc:
cd python && docker build -t ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_GRPC_IMG} -f custom_transformer_grpc.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_GRPC_IMG} -f custom_transformer_grpc.Dockerfile .

docker-push-custom-transformer-grpc: docker-build-custom-transformer-grpc
docker push ${KO_DOCKER_REPO}/${CUSTOM_TRANSFORMER_GRPC_IMG}

docker-build-alibi:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${ALIBI_IMG} -f alibiexplainer.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${ALIBI_IMG} -f alibiexplainer.Dockerfile .

docker-push-alibi: docker-build-alibi
docker push ${KO_DOCKER_REPO}/${ALIBI_IMG}

docker-build-aif:
cd python && docker build -t ${KO_DOCKER_REPO}/${AIF_IMG} -f aiffairness.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${AIF_IMG} -f aiffairness.Dockerfile .

docker-push-aif: docker-build-aif
docker push ${KO_DOCKER_REPO}/${AIF_IMG}

docker-build-art:
cd python && docker build -t ${KO_DOCKER_REPO}/${ART_IMG} -f artexplainer.Dockerfile .
cd python && docker buildx build -t ${KO_DOCKER_REPO}/${ART_IMG} -f artexplainer.Dockerfile .

docker-push-art: docker-build-art
docker push ${KO_DOCKER_REPO}/${ART_IMG}

docker-build-storageInitializer:
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG} -f storage-initializer.Dockerfile .
cd python && docker buildx build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG} -f storage-initializer.Dockerfile .

docker-push-storageInitializer: docker-build-storageInitializer
docker push ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG}

docker-build-qpext:
cd qpext && docker build -t ${KO_DOCKER_REPO}/${QPEXT_IMG} -f qpext.Dockerfile .
cd qpext && docker buildx build -t ${KO_DOCKER_REPO}/${QPEXT_IMG} -f qpext.Dockerfile .

docker-build-push-qpext: docker-build-qpext
docker push ${KO_DOCKER_REPO}/${QPEXT_IMG}
Expand All @@ -325,7 +325,7 @@ $(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

apidocs:
docker build -f docs/apis/Dockerfile --rm -t apidocs-gen . && \
docker buildx build -f docs/apis/Dockerfile --rm -t apidocs-gen . && \
docker run -it --rm -v $(CURDIR)/pkg/apis:/go/src/github.com/kserve/kserve/pkg/apis -v ${PWD}/docs/apis:/go/gen-crd-api-reference-docs/apidocs apidocs-gen

.PHONY: check-doc-links
Expand Down
Loading

0 comments on commit 852334b

Please sign in to comment.