Skip to content

Commit

Permalink
Remove removebg-core as a dependency and remove installation of remov…
Browse files Browse the repository at this point in the history
…ebg in Dockerfile (kubeflow#68)
  • Loading branch information
Jerome-Kaleido authored Nov 25, 2021
1 parent d99dc49 commit 8636e53
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 75 deletions.
46 changes: 26 additions & 20 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,10 @@ RUN --mount=type=secret,id=fury_auth_token,mode=0444 \
"downscale-area==${CUDA_DOWNSCALE_VERSION}+cc${COMPUTE_CAPABILITY}" \
"connected-component-labeling==${CUDA_CCL_VERSION}+cc${COMPUTE_CAPABILITY}"

########################################################################################################################
# TODO: Remove this, once this ticket is resolved:
# https://www.notion.so/kaleidoai/Split-kaleido-removebg-into-service-and-library-f3b8394d449a4505afff9636078e88c0
#
# The library should then be installed only through the requirements.txt file.
#
# If REMOVEBG_CORE_PY_VERSION=main, it installs the latest version of the library. If REMOVEBG_CORE_PY_VERSION is
# set to a version number, it installs the specified version of the library instead.
########################################################################################################################

# https://github.com/remove-bg/kaleido-core-removebg
ARG REMOVEBG_CORE_PY_VERSION=main

# Install required python packages
RUN --mount=type=secret,id=fury_auth_token,mode=0444 --mount=type=cache,target=/root/.cache/pip pip install \
--progress-bar off --extra-index-url https://$(cat /run/secrets/fury_auth_token):@deps.kaleido.ai/pypi/ \
removebg-core$([ ${REMOVEBG_CORE_PY_VERSION} = "main" ] && echo "" || echo "==${REMOVEBG_CORE_PY_VERSION}")
########################################################################################################################

# Add Kaleido Models
ARG GITHUB_AUTH_TOKEN

# Add requirements
# Add models file description
COPY --chown=app:app kaleido-models.yml .

RUN --mount=type=secret,id=github_auth_token,mode=0444 \
Expand All @@ -109,6 +90,31 @@ RUN --mount=type=secret,id=github_auth_token,mode=0444 \
&& pip uninstall -y yq \
&& rm kaleido-models.yml kaleido-models.tsv


########################################################################################################################
# TODO: Remove this, once this ticket is resolved:
# https://www.notion.so/kaleidoai/Split-kaleido-removebg-into-service-and-library-f3b8394d449a4505afff9636078e88c0
#
# The library should then be installed only through the requirements.txt file.
#
# If REMOVEBG_CORE_PY_VERSION=main, it installs the latest version of the library. If REMOVEBG_CORE_PY_VERSION is
# set to a version number, it installs the specified version of the library instead.
########################################################################################################################

# # https://github.com/remove-bg/kaleido-core-removebg
# ARG REMOVEBG_CORE_PY_VERSION=main
#
# # Install required python packages
# RUN --mount=type=secret,id=fury_auth_token,mode=0444 --mount=type=cache,target=/root/.cache/pip pip install \
# --progress-bar off --extra-index-url https://$(cat /run/secrets/fury_auth_token):@deps.kaleido.ai/pypi/ \
# removebg-core$([ ${REMOVEBG_CORE_PY_VERSION} = "main" ] && echo "" || echo "==${REMOVEBG_CORE_PY_VERSION}")
########################################################################################################################

# Manually copy removebg-core library
RUN mkdir removebg
COPY --chown=app:app removebg/models removebg/models
COPY --chown=app:app removebg/*.py removebg/

# Remove build dependencies
USER root
RUN apt-get purge -y ${BUILD_DEPENDENCIES} \
Expand Down
1 change: 0 additions & 1 deletion core/requirements-deploy.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ msgpack<1.0.0
pandas<1.4.0
nibabel<2.5.0,>=2.4.0
pillow>=7.2.0,<9.0.0
removebg-core>1.0.0,<2.0.0
33 changes: 6 additions & 27 deletions core/requirements-deploy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,38 @@ google==3.0.0
idna==3.3
# via requests
kaleido-core==2.5.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
msgpack==0.6.2
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
nibabel==2.4.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
numpy==1.21.4
# via
# -r requirements-deploy.in
# kaleido-core
# nibabel
# opencv-python
# pandas
# removebg-core
# scipy
# torchvision
opencv-python==4.5.4.60
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
pandas==1.3.4
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
pathtools==0.1.2
# via wandb
pika==1.2.0
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
pillow==8.4.0
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
# torchvision
promise==2.3
# via wandb
Expand All @@ -83,8 +72,6 @@ pytz==2021.3
# via pandas
pyyaml==6.0
# via wandb
removebg-core==1.11.0
# via -r requirements-deploy.in
requests==2.26.0
# via
# kaleido-core
Expand All @@ -94,9 +81,7 @@ scipy==1.7.3
sentry-sdk==1.5.0
# via wandb
shadowgen-core==1.7.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
shortuuid==1.0.8
# via wandb
six==1.16.0
Expand All @@ -116,13 +101,11 @@ torch==1.10.0+cu113
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
# torchvision
torchvision==0.11.1+cu113
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
tqdm==4.62.3
# via kaleido-core
typing-extensions==4.0.0
Expand All @@ -135,10 +118,6 @@ urllib3==1.26.7
# sentry-sdk
# wandb
wandb==0.11.2
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
wheel==0.37.0
# via
# kaleido-core
# removebg-core
# via kaleido-core
33 changes: 6 additions & 27 deletions core/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ jeepney==0.7.1
# keyring
# secretstorage
kaleido-core==2.5.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
keyring==23.3.0
# via twine
mccabe==0.6.1
Expand All @@ -80,13 +78,10 @@ msgpack==0.6.2
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
mypy-extensions==0.4.3
# via black
nibabel==2.4.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
nodeenv==1.6.0
# via pre-commit
numpy==1.21.4
Expand All @@ -96,23 +91,19 @@ numpy==1.21.4
# nibabel
# opencv-python
# pandas
# removebg-core
# scipy
# torchvision
opencv-python==4.5.4.60
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
packaging==21.3
# via
# bleach
# build
# pytest
pandas==1.3.4
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
pathspec==0.9.0
# via black
pathtools==0.1.2
Expand All @@ -123,12 +114,10 @@ pika==1.2.0
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
pillow==8.4.0
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
# torchvision
pkginfo==1.8.1
# via twine
Expand Down Expand Up @@ -172,8 +161,6 @@ readme-renderer==30.0
# via twine
regex==2021.11.10
# via black
removebg-core==1.11.0
# via -r requirements-deploy.in
requests==2.26.0
# via
# kaleido-core
Expand All @@ -191,9 +178,7 @@ secretstorage==3.3.1
sentry-sdk==1.5.0
# via wandb
shadowgen-core==1.7.1
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
shortuuid==1.0.8
# via wandb
six==1.16.0
Expand Down Expand Up @@ -224,13 +209,11 @@ torch==1.10.0+cu113
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
# torchvision
torchvision==0.11.1+cu113
# via
# -r requirements-deploy.in
# kaleido-core
# removebg-core
tqdm==4.62.3
# via
# kaleido-core
Expand All @@ -249,14 +232,10 @@ urllib3==1.26.7
virtualenv==20.10.0
# via pre-commit
wandb==0.11.2
# via
# -r requirements-deploy.in
# removebg-core
# via -r requirements-deploy.in
webencodings==0.5.1
# via bleach
wheel==0.37.0
# via
# kaleido-core
# removebg-core
# via kaleido-core
zipp==3.6.0
# via importlib-metadata

0 comments on commit 8636e53

Please sign in to comment.