give me a docker example for livekit agent with po...
# ask-ai
a
give me a docker example for livekit agent with poetry
t
Thanks for reaching out, Isaac. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Here is an example Dockerfile for running a LiveKit agent with Poetry as the dependency manager. This approach follows LiveKit agent Docker best practices and integrates Poetry for Python dependency management:
Copy code
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.11.6
FROM python:${PYTHON_VERSION}-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

ARG UID=10001
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "/home/appuser" \
    --shell "/sbin/nologin" \
    --uid "${UID}" \
    appuser

RUN apt-get update && \
    apt-get install -y \
    gcc \
    g++ \
    python3-dev \
    curl \
    && rm -rf /var/lib/apt/lists/*

RUN curl -sSL <https://install.python-poetry.org> | python -
ENV PATH="/root/.local/bin:$PATH"

RUN poetry config virtualenvs.create false
RUN poetry config virtualenvs.in-project true
RUN ln -sf /root/.local/bin/poetry /usr/local/bin/poetry

USER appuser

RUN mkdir -p /home/appuser/.cache
RUN chown -R appuser /home/appuser/.cache

WORKDIR /home/appuser

COPY pyproject.toml poetry.lock* ./
RUN poetry install --no-dev --no-interaction --no-ansi

COPY . .

RUN python main.py download-files
EXPOSE 8081
CMD ["python", "main.py", "start"]
• Place your
pyproject.toml
and
poetry.lock
in your project root, and ensure
main.py
launches your agent. • This setup uses a non-root
appuser
for improved security, installs system dependencies, and configures Poetry not to create virtual environments. • The
download-files
step is included to mirror LiveKit agent examples that typically pre-fetch any dependent models or resources before startup. This example is consistent with LiveKit agent build patterns and incorporates Poetry for dependency management. References: • Poetry agent example and best-practices • LiveKit agent security and containerization patterns Sources: docker/lerobot-gpu-dev/Dockerfile | pkg/agentfs/examples/python.Dockerfile | README.md | examples/Dockerfile-example | agent/Dockerfile
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!