Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a custom dockerfile #365

Open
arhaang13 opened this issue Jun 20, 2024 · 8 comments
Open

Creating a custom dockerfile #365

arhaang13 opened this issue Jun 20, 2024 · 8 comments

Comments

@arhaang13
Copy link

Hi,

I created custom plugins and I now want to build the dockerfile and run the same using chainlit how do i do so. I am trying to deploy the same using docker on a remote server.

Thanks

@liqul
Copy link
Contributor

liqul commented Jun 20, 2024

We don't support execution inside a 'remote' container now.

@arhaang13
Copy link
Author

Hi,

I am basically trying to deploy a custom UI page for taskWeaver. I changed the app.py file and chainlit.md file. But the UI still did not change.
Can you help me out with the same.

Then, I want to deploy it using docker. So I was trying to build the dockerfile inside the all_in_one_container.

Please help me out with the same.

Thank you!

@liqul
Copy link
Contributor

liqul commented Jun 21, 2024

Have you re-build the docker image after making those changes? The script is here. You may want to change the name of the image in the script, by changing

version="0.2"
imageName="taskweavercontainers/taskweaver-all-in-one"

Once the script is ready, just run it to build the new image.

@arhaang13
Copy link
Author

Thanks. I have another question.

I want to add my custom logo instead of the TaskWeaver logo. I cannot find the place where the logo's image is being used in the chainlit frontend. Can you help out with the same,

Thank you!

@liqul
Copy link
Contributor

liqul commented Jun 27, 2024

I guess you can find it under playground/UI/public?

@GihanMora
Copy link

I am facing the same issue. With chainlit.md updated, the changes are not reflected in the front end. I am using my own docker file. I rebuilt the image after the changes. And where does app.py import chainlit.md file for the welcome messages? Is there a way to overwrite them/disable.

my docker file

# Use an official Python runtime as a parent image
FROM python:3.10

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container at /app
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Install the chainlit library
RUN pip install chainlit==1.1.202

# Copy the current directory contents into the container at /app
COPY . .

# Expose port 8000 for the application
EXPOSE 8000

# Define environment variable
ENV PYTHONUNBUFFERED=1

# List files in the working directory to ensure the necessary files are copied
RUN ls -la /app/TaskWeaver/playground/UI

# Command to run the application
CMD ["chainlit", "run", "/app/TaskWeaver/playground/UI/app.py"]

@liqul
Copy link
Contributor

liqul commented Jul 8, 2024

I am facing the same issue. With chainlit.md updated, the changes are not reflected in the front end. I am using my own docker file. I rebuilt the image after the changes. And where does app.py import chainlit.md file for the welcome messages? Is there a way to overwrite them/disable.

my docker file

# Use an official Python runtime as a parent image
FROM python:3.10

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container at /app
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Install the chainlit library
RUN pip install chainlit==1.1.202

# Copy the current directory contents into the container at /app
COPY . .

# Expose port 8000 for the application
EXPOSE 8000

# Define environment variable
ENV PYTHONUNBUFFERED=1

# List files in the working directory to ensure the necessary files are copied
RUN ls -la /app/TaskWeaver/playground/UI

# Command to run the application
CMD ["chainlit", "run", "/app/TaskWeaver/playground/UI/app.py"]

The problem is that you run chainlit in a directory other than the /xxx/playground/UI/. So chainlit will create its own chainlit.md in your current working directory. So, the solution is firstly changing your directory to /xxx/playground/UI/ and then starting chainlit from there.

@dev-sabir
Copy link

dev-sabir commented Oct 23, 2024

Have you re-build the docker image after making those changes? The script is here. You may want to change the name of the image in the script, by changing

version="0.2"
imageName="taskweavercontainers/taskweaver-all-in-one"

Once the script is ready, just run it to build the new image.

I cloned the repo:
git clone https://github.com/microsoft/TaskWeaver.git

made this change:
inside docker/all_in_one_container/Dockerfile and update the last line from ENTRYPOINT ["/app/entrypoint.sh"] to ENTRYPOINT ["/app/entrypoint_chainlit.sh"]

then went to scripts/build_all_in_one.sh and update this line to version="0.2" to version="latest"

then I do
cd scripts and run sh build_all_in_one.sh
then I run the image

docker run -it --net=host -e LLM_API_BASE=base_url
-e LLM_API_KEY=api_key
-e LLM_API_TYPE=azure
-e LLM_MODEL=gpt-4o
--name taskweaver taskweavercontainers/taskweaver-all-in-one:latest

when I went to http://localhost:8000/ I didn't see the markdown and when I ask a prompt, I get this in the log and markdown isn't loaded properly

2024-10-22 11:16:27 - Step.init() got an unexpected keyword argument 'root'
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/chainlit/utils.py", line 44, in wrapper
    return await user_function(**params_values)
  File "/usr/local/lib/python3.10/site-packages/chainlit/callbacks.py", line 118, in with_parent_id
    await func(message)
  File "/app/playground/UI/app.py", line 403, in main
    async with cl.Step(name="", show_input=True, root=True) as root_step:
TypeError: Step.init() got an unexpected keyword argument 'root'

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants