-
Notifications
You must be signed in to change notification settings - Fork 120
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
[WIP] Add Dockerfile for modelmesh-minio-examples
image
#300
Closed
tedhtchang
wants to merge
12
commits into
kserve:main
from
tedhtchang:Add-dockerfile-for-modelmesh-minio-examples-image
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
08b1ee7
Add Dockerfile for modelmesh-minio-examples image
tedhtchang cee8e3a
Add a dockerfile for the fvt image
tedhtchang 9b1a4bd
Fix format
tedhtchang 97ec0d6
Fix: Make OpenShift compliant; consolidate to single Dockerfile
njhill 8fe5e4e
Merge branch 'kserve:main' into Add-dockerfile-for-modelmesh-minio-ex…
tedhtchang f03f23b
Minor update to README.md
ckadner c58bdea
Move minio-examples to project root
ckadner 215bcc0
Update Dockerfile and README for non-root user
ckadner 33c2f17
Shrink container image size
ckadner 6cba3f4
Reformat README
rafvasq 432c944
Add TorchServe models for fvt image build
rafvasq dd7c877
Update README.md
ckadner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2023 IBM Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Using specific tag for now, there was some reason newer minio versions didn't work | ||
FROM quay.io/cloudservices/minio:RELEASE.2021-06-17T00-10-46Z.hotfix.35a0912ff as minio-examples | ||
|
||
EXPOSE 9000 | ||
|
||
USER root | ||
|
||
RUN useradd -u 1000 -g 0 modelmesh | ||
RUN mkdir -p /data1/modelmesh-example-models | ||
RUN chown -R 1000:0 /data1 | ||
|
||
COPY --chown=1000:0 sklearn /data1/modelmesh-example-models/sklearn/ | ||
COPY --chown=1000:0 lightgbm /data1/modelmesh-example-models/lightgbm/ | ||
COPY --chown=1000:0 onnx /data1/modelmesh-example-models/onnx/ | ||
COPY --chown=1000:0 pytorch /data1/modelmesh-example-models/pytorch/ | ||
COPY --chown=1000:0 xgboost /data1/modelmesh-example-models/xgboost/ | ||
COPY --chown=1000:0 tensorflow /data1/modelmesh-example-models/tensorflow/ | ||
COPY --chown=1000:0 keras /data1/modelmesh-example-models/keras/ | ||
|
||
USER modelmesh | ||
|
||
|
||
# Image with additional models used in the FVTs | ||
FROM minio-examples as minio-fvt | ||
|
||
USER root | ||
|
||
COPY --chown=1000:0 fvt /data1/modelmesh-example-models/fvt/ | ||
|
||
USER modelmesh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# ModelMesh MinIO Examples | ||
|
||
This MinIO Docker image contains example models. When ModelMesh is deployed with | ||
the `--quickstart` flag, the example models are deployed via this image. | ||
|
||
## Build the image | ||
|
||
From inside the `minio_examples` directory build the docker image: | ||
|
||
```sh | ||
docker build --target minio-examples -t kserve/modelmesh-minio-examples:latest . | ||
``` | ||
|
||
**Note**: When ModelMesh is deployed with the `--fvt` flag then the `modelmesh-minio-dev-examples` | ||
image will be deployed instead. To build it, run the docker build command with the | ||
`minio-fvt` target: | ||
|
||
```sh | ||
docker build --target minio-fvt -t kserve/modelmesh-minio-dev-examples:latest . | ||
``` | ||
|
||
Push the newly built images to DockerHub: | ||
|
||
```shell | ||
docker push kserve/modelmesh-minio-examples:latest | ||
docker push kserve/modelmesh-minio-dev-examples:latest | ||
``` | ||
|
||
## Start the container | ||
|
||
Start a "modelmesh-minio-examples" container: | ||
|
||
```sh | ||
docker run --rm --name "modelmesh-minio-examples" \ | ||
-u "1000" \ | ||
-p "9000:9000" \ | ||
-e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \ | ||
-e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \ | ||
kserve/modelmesh-minio-examples:latest server /data1 | ||
``` | ||
|
||
## Test the image using the MinIO client | ||
|
||
Install the [MinIO client](https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart), `mc`. | ||
|
||
Create an alias `localminio` for an local instance: | ||
|
||
```sh | ||
mc alias set localminio http://localhost:9000 AKIAIOSFODNN7EXAMPLE wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | ||
``` | ||
|
||
List objects in the instance's bucket: | ||
|
||
```sh | ||
mc ls -r localminio/modelmesh-example-models/ | ||
``` | ||
|
||
### Stop and remove the docker container | ||
|
||
To shut down the "modelmesh-minio-examples" docker container run the following | ||
commands: | ||
|
||
```sh | ||
docker stop "modelmesh-minio-examples" | ||
docker rm "modelmesh-minio-examples" | ||
``` |
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"implementation": "mlserver_lightgbm.LightGBMModel" | ||
} |
2,005 changes: 2,005 additions & 0 deletions
2,005
minio_examples/fvt/lightgbm/mushroom-dup/model.bst
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"implementation": "mlserver_lightgbm.LightGBMModel" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
platform: "onnxruntime_onnx" | ||
max_batch_size: 32 | ||
input [ | ||
{ | ||
name: "input" | ||
data_type: TYPE_FP32 | ||
dims: [3, 224, 224] | ||
} | ||
] | ||
output [ | ||
{ | ||
name: "output" | ||
data_type: TYPE_FP32 | ||
dims: [3] | ||
label_filename: "test_labels.txt" | ||
} | ||
] | ||
instance_group [ | ||
{ | ||
kind: KIND_AUTO | ||
count: 1 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class1 | ||
class2 | ||
class3 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
backend: "onnxruntime" | ||
max_batch_size: 0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
backend: "onnxruntime" | ||
max_batch_size: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "Input3", | ||
"datatype": "FP32", | ||
"shape": [1, 1, 28, 28] | ||
} | ||
], | ||
"outputs": [ | ||
{ | ||
"name": "Plus214_Output_0", | ||
"datatype": "FP32", | ||
"shape": [1, 10] | ||
} | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0"?> | ||
<mapping> | ||
<map> | ||
<framework name="Input3" output_port_id="Input3" /> | ||
<IR name="Input3" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Parameter5" output_port_id="Parameter5" /> | ||
<IR name="Parameter5" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Convolution28" output_port_id="Convolution28_Output_0" /> | ||
<IR name="Convolution28" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="Parameter6" output_port_id="Parameter6" /> | ||
<IR name="Parameter6" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Plus30" output_port_id="Plus30_Output_0" /> | ||
<IR name="Plus30" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="ReLU32" output_port_id="ReLU32_Output_0" /> | ||
<IR name="ReLU32" output_port_id="1" /> | ||
</map> | ||
<map> | ||
<framework name="Pooling66" output_port_id="Pooling66_Output_0" /> | ||
<IR name="Pooling66" output_port_id="1" /> | ||
</map> | ||
<map> | ||
<framework name="Parameter87" output_port_id="Parameter87" /> | ||
<IR name="Parameter87" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Convolution110" output_port_id="Convolution110_Output_0" /> | ||
<IR name="Convolution110" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="Parameter88" output_port_id="Parameter88" /> | ||
<IR name="Parameter88" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Plus112" output_port_id="Plus112_Output_0" /> | ||
<IR name="Plus112" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="ReLU114" output_port_id="ReLU114_Output_0" /> | ||
<IR name="ReLU114" output_port_id="1" /> | ||
</map> | ||
<map> | ||
<framework name="Pooling160" output_port_id="Pooling160_Output_0" /> | ||
<IR name="Pooling160" output_port_id="1" /> | ||
</map> | ||
<map> | ||
<framework name="Pooling160_Output_0_reshape0_shape" output_port_id="Pooling160_Output_0_reshape0_shape" /> | ||
<IR name="Pooling160_Output_0_reshape0_shape" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Times212_reshape0" output_port_id="Pooling160_Output_0_reshape0" /> | ||
<IR name="Times212_reshape0" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="Times212_reshape1" output_port_id="Parameter193_reshape1" /> | ||
<IR name="Times212_reshape1" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Times212" output_port_id="Times212_Output_0" /> | ||
<IR name="Times212" output_port_id="2" /> | ||
</map> | ||
<map> | ||
<framework name="Parameter194" output_port_id="Parameter194" /> | ||
<IR name="Parameter194" output_port_id="0" /> | ||
</map> | ||
<map> | ||
<framework name="Plus214_Output_0" output_port_id="Plus214_Output_0" /> | ||
<IR name="Plus214_Output_0" output_port_id="2" /> | ||
</map> | ||
</mapping> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
as Nick pointed out, doing a
chown
after theCOPY
layers causes the final Docker image to be about 86 MB larger.I reverted to
COPY --chown 1000:0 ...
in commit 33c2f17There 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.
https://hub.docker.com/r/kserve/modelmesh-minio-examples/tags
https://hub.docker.com/r/kserve/modelmesh-minio-dev-examples/tags