FROM python:3.13-slim # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONPATH="${PYTHONPATH}:/app/src" # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential # Install Poetry RUN pip install poetry==2.1.4 # Set work directory WORKDIR /app # Copy Poetry configuration files COPY pyproject.toml poetry.lock* ./ # Configure Poetry and install dependencies RUN poetry config virtualenvs.create false \ && poetry install --only=main --no-root \ && rm -rf $POETRY_CACHE_DIR # Copy application code COPY src/ ./src/ # Create directories for bot persistence RUN mkdir -p /app/data/actors # Create non-root user RUN groupadd -r botuser && useradd -r -g botuser botuser RUN chown -R botuser:botuser /app USER botuser # Health check - check if the bot process is running HEALTHCHECK --interval=60s --timeout=30s --start-period=10s --retries=3 \ CMD pgrep -f "docbot.main" || exit 1 RUN ls -la # Run the chatbot CMD ["python", "-m", "docbot.main"]