This message was deleted.
# ask-for-help
s
This message was deleted.
c
I can’t think of a way to do it with
bentoml build
, but yes you can customize this in
bentoml containerize
step
using the docker template api to add a block in the generated dockerfile:
Copy code
{% extends bento_base_template %}
{% block SETUP_BENTO_COMPONENTS %}
{{ super() }}

ARG PIP_EXTRA_INDEX_URL
ENV PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}

{% endblock %}
In containerize step:
Copy code
bentoml containerize --build-arg PIP_EXTRA_INDEX_URL=<http://localhost:8080/simple/> ...
although this is just some pseudo-code for demonstration. I haven’t fully tested it, but it should work in theory.
m
Wow ok I will try that. Thank you so much!
j
if your extra_index_url contains an access token, you might consider using Docker Secrets: https://towardsdatascience.com/secure-your-docker-images-with-docker-secrets-f2b92ec398a0
👏 1
🙌 1
m
I used the docker template but I had to set the extra url after
SETUP_BENTO_USER
and not
SETUP_BENTO_COMPONENTS
otherwise it was setting the extra url after the package install. With that the containerize worked
However the bentoml build raises an issue during the
Locking PyPI package versions.
Copy code
pip._internal.exceptions.DistributionNotFound: No matching distribution found for mypackage==0.0.1
The build finishes, but it prints that error. I guess there is no way to fix that?
Could that give any problems?
c
Hi @Mikel Menta, you can set
lock_packages=False
to work around this issue https://docs.bentoml.org/en/latest/concepts/bento.html#pypi-package-locking
it was due to
pip-tools
not picking up the extra index env var
that’s probably something we can improve on BentoML side
Although I’d recommend you manually specify package versions in your bentofile.yaml, now lock_packages is set to False
m
Thank you! it works perfect now
🙌 1