Slackbot
11/03/2022, 11:05 PMGreg
11/03/2022, 11:05 PMuse_conda = not self.conda.is_empty()
use_cuda = self.docker.cuda_version is not None
if use_cuda and use_conda:
raise BentoMLException(
"BentoML does not support using both conda dependencies and setting a CUDA version for GPU. If you need both conda and CUDA, use a custom base image or create a dockerfile_template, see <https://docs.bentoml.org/en/latest/concepts/bento.html#custom-base-image-advanced>"
)Greg
11/03/2022, 11:05 PMAaron Pham
11/03/2022, 11:26 PMGreg
11/03/2022, 11:28 PMAaron Pham
11/03/2022, 11:28 PMGreg
11/03/2022, 11:31 PMAaron Pham
11/03/2022, 11:31 PMAaron Pham
11/03/2022, 11:31 PMGreg
11/03/2022, 11:31 PMGreg
11/03/2022, 11:32 PMAaron Pham
11/03/2022, 11:32 PMAaron Pham
11/03/2022, 11:32 PMGreg
11/03/2022, 11:32 PMpython and conda sections together?Aaron Pham
11/03/2022, 11:33 PMGreg
11/03/2022, 11:33 PMpip and others via condaGreg
11/03/2022, 11:33 PMGreg
11/03/2022, 11:33 PMAaron Pham
11/03/2022, 11:48 PMAaron Pham
11/03/2022, 11:48 PMGreg
11/04/2022, 12:12 AMconda
• conda install the single dependency that pip doesn't allow for in setup.shAaron Pham
11/04/2022, 12:15 AM{% import '_macros.j2' as common %}
{% extends bento_base_template %}
{# Make sure to change the correct python_version and conda version accordingly. #}
{# example: py38_4.10.3 #}
{# refers to <https://repo.anaconda.com/miniconda/> for miniconda3 base #}
{% set conda_version="py39_4.11.0" %}
{% set conda_path="/opt/conda" %}
{% set conda_exec=[conda_path, "bin", "conda"] | join("/") %}
{% block SETUP_BENTO_BASE_IMAGE %}
FROM debian:bullseye-slim as conda-build
RUN --mount=type=cache,from=cached,sharing=shared,target=/var/cache/apt \
--mount=type=cache,from=cached,sharing=shared,target=/var/lib/apt \
apt-get update -y && \
apt-get install -y --no-install-recommends --allow-remove-essential \
software-properties-common \
bzip2 \
ca-certificates \
git \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
mercurial \
openssh-client \
procps \
subversion \
wget && \
apt-get clean
ENV PATH {{ conda_path }}/bin:$PATH
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
ARG CONDA_VERSION={{ conda_version }}
RUN set -ex && \
UNAME_M=$(uname -m) && \
if [ "${UNAME_M}" = "x86_64" ]; then \
MINICONDA_URL="<https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh>"; \
SHA256SUM="4ee9c3aa53329cd7a63b49877c0babb49b19b7e5af29807b793a76bdb1d362b4"; \
elif [ "${UNAME_M}" = "s390x" ]; then \
MINICONDA_URL="<https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-s390x.sh>"; \
SHA256SUM="e5e5e89cdcef9332fe632cd25d318cf71f681eef029a24495c713b18e66a8018"; \
elif [ "${UNAME_M}" = "aarch64" ]; then \
MINICONDA_URL="<https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-aarch64.sh>"; \
SHA256SUM="00c7127a8a8d3f4b9c2ab3391c661239d5b9a88eafe895fd0f3f2a8d9c0f4556"; \
elif [ "${UNAME_M}" = "ppc64le" ]; then \
MINICONDA_URL="<https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-ppc64le.sh>"; \
SHA256SUM="8ee1f8d17ef7c8cb08a85f7d858b1cb55866c06fcf7545b98c3b82e4d0277e66"; \
fi && \
wget "${MINICONDA_URL}" -O miniconda.sh -q && echo "${SHA256SUM} miniconda.sh" > shasum && \
if [ "${CONDA_VERSION}" != "latest" ]; then \
sha256sum --check --status shasum; \
fi && \
mkdir -p /opt && \
sh miniconda.sh -b -p {{ conda_path }} && rm miniconda.sh shasum && \
find {{ conda_path }}/ -follow -type f -name '*.a' -delete && \
find {{ conda_path }}/ -follow -type f -name '*.js.map' -delete && \
{{ conda_exec }} clean -afy
{{ super() }}
ENV PATH {{ conda_path }}/bin:$PATH
COPY --from=conda-build {{ conda_path }} {{ conda_path }}
RUN set -ex && \
ln -s {{ conda_path }}/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". {{ conda_path }}/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "{{ conda_exec }} activate base" >> ~/.bashrc
{% endblock %}
{% block SETUP_BENTO_ENVARS %}
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
{{ super() }}
{{ common.setup_conda(__python_version__, bento__path, conda_path=conda_path) }}
{% endblock %}
Then you can specify this templates as
docker:
dockerfile_template: ./Dockerfile.templateAaron Pham
11/04/2022, 12:21 AM