-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add code for preventing chainlit server timeout and dockerfile for deployment
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
__pycache__ | ||
*cache/ | ||
*.log | ||
log/ | ||
|
||
*.DS_STORE | ||
|
||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
|
||
#====== Create builder image | ||
FROM python:3.11-slim as builder | ||
|
||
# create and activate virtual environment | ||
RUN python -m venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
COPY requirements.txt . | ||
# Use external cache to avoid fetching packages from the internet each time -- https://docs.docker.com/build/cache/#use-the-dedicated-run-cache | ||
RUN --mount=type=cache,mode=0755,target=/root/.cache pip3 install -r requirements.txt | ||
|
||
#====== Create final image | ||
FROM python:3.11-slim as runner | ||
|
||
# Set up a new user so we don't run as root | ||
RUN useradd --create-home -u 1000 tron | ||
RUN chown -R tron:tron /home/tron | ||
|
||
USER tron | ||
ENV HOME=/home/tron | ||
WORKDIR $HOME/app | ||
|
||
COPY --chown=tron --from=builder /opt/venv /opt/venv | ||
# Activate virtual environment | ||
ENV VIRTUAL_ENV=/opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
# Ensure all messages always reach console | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
EXPOSE 8000 | ||
HEALTHCHECK CMD curl http://localhost:8000 || exit 1 | ||
ENTRYPOINT ["chainlit", "run", "--port", "8000", "-h", "chainlit-call-summaries-bot.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters