able-honey-93000
07/10/2025, 12:19 PMtall-airline-16756
07/10/2025, 12:19 PMtall-airline-16756
07/10/2025, 12:20 PM# 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/Dockerfiletall-airline-16756
07/10/2025, 12:28 PM