Slackbot
10/18/2022, 10:43 PMAaron Pham
10/18/2022, 10:52 PMShihgian Lee
10/18/2022, 10:55 PMAaron Pham
10/18/2022, 10:56 PMDOCKER_BUILDKIT: 1
Docker should be able to use buildkitAaron Pham
10/18/2022, 10:57 PMAaron Pham
10/18/2022, 10:58 PMShihgian Lee
10/18/2022, 11:04 PMDOCKER_BUILDKIT=1 docker build .
as stated in the docker doc.Aaron Pham
10/18/2022, 11:05 PMShihgian Lee
10/18/2022, 11:36 PMDOCKER_BUILDKIT=1
flag seem to resolve the issue. But, I am getting another containerize issue. The following is my step for building the dockerfile:
1. bentoml export my_classifier:latest saved/bento.tar.gz
2. tar -xf saved/bento.tar.gz -C saved/
3. container -d saved/env/docker # container is from our DevOps script.
I am getting the following error:
bash: /home/bentoml/bento/env/python/install.sh: No such file or directory
The actual location of the script is saved/env/python/install.sh
. How do we fix that?Aaron Pham
10/18/2022, 11:37 PMcontainer
executable doing?Shihgian Lee
10/18/2022, 11:38 PMAaron Pham
10/18/2022, 11:38 PMBENTOML_HOME
environment inside the container--build-arg BENTOML_HOME=saved/
Aaron Pham
10/18/2022, 11:39 PMbentoml containerize
as it accepts all of docker options
docker build --build-args ... --env
bentoml containerize bento:tag --build-args ... --env
Shihgian Lee
10/18/2022, 11:40 PMcontainer
that you referred to above.Aaron Pham
10/18/2022, 11:41 PMcontainer
accepts all docker arguments, then --build-arg
solution could fix the issue.Shihgian Lee
10/18/2022, 11:41 PMShihgian Lee
10/18/2022, 11:42 PMShihgian Lee
10/18/2022, 11:45 PMsg. Ifi will have to look at the script. bentoml 1.0 is making deployment to our infrastructure harder and harder. Cc @Bo @Tim Liu @Chaoyuaccepts all docker arguments, thencontainer
solution could fix the issue.--env
Tim Liu
10/18/2022, 11:49 PMChaoyu
10/18/2022, 11:52 PMChaoyu
10/18/2022, 11:52 PMShihgian Lee
10/18/2022, 11:54 PMChaoyu
10/18/2022, 11:54 PMbentoml containerize
as it is a drop-in replacement for docker build
and ensures all the settings are correct. It is still possible to do the manual docker build like 0.13, but it will need some extra manual settings like DOCKER_BUILDKIT=1
, and making sure the build_context and docekrfile path are correctAaron Pham
10/18/2022, 11:55 PMdocker build -f saved/env/docker/Dockerfile saved/
Shihgian Lee
10/18/2022, 11:57 PMbuild
and container
stages in the gitlab ci:
build:
image: <http://gcr.io/python-build:3.7|gcr.io/python-build:3.7>
stage: build
only:
- main
artifacts:
when: on_success
expire_in: "30 min"
paths:
- saved/*
script:
- pip3 install --upgrade pip
- pip3 install -r requirements.txt
- gcloud auth activate-service-account --key-file=<redacted>
- ./fetch-artifacts.sh
- PYTHONPATH=$(pwd) python3 pack/package.py
- bentoml build -f ./src/bentofile.yaml ./src/
- mkdir saved
- bentoml export demand_transformation:latest saved/bento.tar.gz
container:
image: <http://gcr.io/java-build:8|gcr.io/java-build:8>
stage: container
dependencies:
- build
only:
- main
script:
- tar -xf saved/bento.tar.gz -C saved/
- export DOCKER_BUILDKIT=1
- container -an my-model -v $BUILD_VERSION -dd saved/env/docker
Chaoyu
10/18/2022, 11:57 PM-dd saved/env/docker
parameter mean?Shihgian Lee
10/18/2022, 11:58 PMChaoyu
10/18/2022, 11:59 PM-f
for the path to Dockerfile, and argument build_context
, which specify the directory to run the buildChaoyu
10/18/2022, 11:59 PMChaoyu
10/18/2022, 11:59 PMBENTO_PATH=$(bentoml get iris_classifier:latest -o path)
docker build -f $BENTO_PATH/env/docker/Dockerfile $BENTO_PATH
Shihgian Lee
10/19/2022, 12:04 AMChaoyu
10/19/2022, 12:07 AMdocker build
command requires, unfortunately there’s no way for BentoML to know that ahead of timeShihgian Lee
10/19/2022, 12:09 AM/home/bentoml/bento/env/python/install.sh
. In bentoml 0.13, I don’t believe we make this assumption right?Shihgian Lee
10/19/2022, 12:09 AM/home/bentoml
part is the problem.Chaoyu
10/19/2022, 12:10 AMChaoyu
10/19/2022, 12:10 AMbuild_context
was set wrongChaoyu
10/19/2022, 12:10 AMDockerfile
no longer lives under the root directory of BentoChaoyu
10/19/2022, 12:12 AMcontainer
script may also provide a separate parameter for the Dockerfile path, in addition to the -dd
which is for build context
, cause they’re very standard docker build
argumentsChaoyu
10/19/2022, 12:13 AMbuild_context
, and docker build command will look for Dockerfile
under that directoryShihgian Lee
10/19/2022, 12:13 AMChaoyu
10/19/2022, 12:14 AMChaoyu
10/19/2022, 12:16 AMShihgian Lee
10/19/2022, 12:16 AMShihgian Lee
10/19/2022, 12:52 AMA minimal docker build command for your usecase
Just saw this for our use case. Thanks @Aaron Pham!Copy codedocker build -f saved/env/docker/Dockerfile saved/
Shihgian Lee
10/19/2022, 8:32 PMIn general, we recommend usingAs I explained previously, we have our own container script. Although I appreciate the help, BentoML should not make assumptions that we will be using the CLI tool. Also, enabling BuildKit is fine now because we are using docker. But, we are in the process of migrating to google build tool. Then BuildKit may not be available in google build. Containerization should be as generic as possible. If needed, performance optimization can be layered on top of it to target specific build tool. I am getting another error in dev environment after deployment. I will post it as a separate thread in the support.as it is a drop-in replacement forbentoml containerize
and ensures all the settings are correct.docker build