promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

Optimized Dockerfile template for building custom Prompt Flow containers.

Open TechPreacher opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. The feature request is not related to a problem, but a possibility to optimize Prompt Flow performance.

Describe the solution you'd like The pf flow build --format docker command adds a Dockerfile based on docker.io/continuumio/miniconda3:latest as can be found in:

https://github.com/microsoft/promptflow/blob/8e55822664ed70b37074fbd77b11a8351c5e0ece/src/promptflow/tests/test_configs/flows/export/linux/Dockerfile#L2

This works, but results in long Docker image build times and possibly unwanted overhead.

Describe alternatives you've considered I found that substituting this with the following Dockerfile results in much faster build times and much smaller and faster pushes to a container registry:

# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:latest

WORKDIR /

COPY ./flow /flow

EXPOSE 8080

COPY ./connections/* /connections/

RUN pip install keyrings.alt -r /flow/requirements.txt

# reset runsvdir
RUN rm -rf /var/runit
COPY ./runit /var/runit
# grant permission
RUN chmod -R +x /var/runit

COPY ./start.sh /
CMD ["bash", "./start.sh"]

Additional context This documentation page also mentiones, that Dockerfiles created to run Prompt Flow should be based on promptflow-runtime-stable.

TechPreacher avatar Nov 10 '23 08:11 TechPreacher

Thanks for the feedback! @TechPreacher The promptflow-runtime-stable is a image that has addtional package & component for azure scenario. It's by design to use a simpler base image as the default one. For now user can change it if they wish to use the other image.

However, we plan to have a new mcr image that has only promptflow executor related pacakge as part effort of side-car support for promptflow runtime. Please expect it in the long term change.

wangchao1230 avatar Nov 14 '23 03:11 wangchao1230

Thanks for the clarification, @wangchao1230

TechPreacher avatar Nov 20 '23 06:11 TechPreacher

Any news about this ? Is there a public Dockerfile of promptflow-runtime ?

prise6 avatar Feb 05 '25 21:02 prise6