Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.
This repository was archived by the owner on Feb 25, 2024. It is now read-only.

AWS Lambda operator does not honor Docker template #48

@giacomov

Description

@giacomov

Describe the bug
Building bentos with the AWS Lambda operator with custom Dockerfile templates does not work. It seems that the AWS lambda operator uses its own Dockerfile template without regards on whether the model to build has its own Dockerfile template.

To Reproduce
Steps to reproduce the issue:

  1. Create a bentoml with a custom Dockerfile template, for example:
{% extends bento_base_template %}
{% block SETUP_BENTO_BASE_IMAGE %}
{{ super() }}
ARG GITHUB_TOKEN

{% endblock %}
{% block SETUP_BENTO_COMPONENTS %}
{{ super() }}
{% endblock %}
  1. Try to build the model with
bentoctl build -b [model name] -f deployment_config.yaml --build-arg GITHUB_TOKEN=testing --verbose
  1. Look for the Dockerfile produced by the command (under /tmp/* as printed by the command). It won't contain the added instructions (in this case, the GITHUB_TOKEN arg)

This happens because of this line for the AWS lambda operator:

~bentoctl/operators/aws-lambda/bentoctl_lambda/create_deployable.py(61)create_deployable()
-> options["dockerfile_template"] = TEMPLATE_PATH

where TEMPLATE_PATH points to a template within the operator itself (in my case, PosixPath('~/bentoctl/operators/aws-lambda/bentoctl_lambda/aws_lambda/template.j2')

Expected behavior

The model is built honoring the custom Dockerfile template included in the bento (or the dockerfile included in the bento under env/docker/Dockerfile).

Environment:

  • OS: Ubuntu 20.04
  • Python Version 3.8.12
  • BentoML Version 1.0.10
  • Bentoctl Version 0.3.4 (same problem also installing the HEAD of the repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions