Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheng26 committed Jun 6, 2024
1 parent 2b69b2d commit c403c7d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 04-call-summaries/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
__pycache__
*cache/
*.log
log/

*.DS_STORE

.git
34 changes: 34 additions & 0 deletions 04-call-summaries/Dockerfile
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"]

0 comments on commit c403c7d

Please sign in to comment.