mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
feat: Complete major refactoring and add initial test suite
This commit addresses a large number of pending tasks from `Tasks.md`, focusing on architectural improvements, documentation consistency, and the introduction of a testing framework. Key changes include: - **Button Dispatcher Agent (`[IMP-003]`):** Refactored the button handling logic into a dedicated `ButtonDispatcher` class. This decouples the dispatcher from handlers and improves modularity. - **Documentation Consistency (`[DOC-001]`):** Updated `AGENTS.md` and `Agent_skills.md` to be consistent with the current codebase, removing outdated information and "Fallo Actual" notes. - **Code Quality Tools (`[TEST-002]`):** Added `black` to the project for consistent code formatting and applied it to the entire `bot/` directory. - **Initial Test Coverage (`[TEST-001]`):** Created a `tests/` directory and implemented a comprehensive suite of unit tests for the critical `FlowEngine` module, using Python's `unittest` framework. - **Task Verification:** Investigated and confirmed that tasks `[ARCH-003]` (Code Duplication), `[PERF-003]` (Flow Engine Memory Usage), and `[PERF-002]` (Voice File Memory Management) were already resolved by previous refactoring. - **Updated `Tasks.md`:** Updated the status of all addressed tasks to reflect the project's current state.
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -1,15 +1,25 @@
|
||||
# Python base image
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /talia_bot
|
||||
# Create a non-root user and group
|
||||
RUN groupadd -r appuser && useradd -r -g appuser appuser
|
||||
|
||||
# Set working directory in the new user's home
|
||||
WORKDIR /home/appuser/talia_bot
|
||||
|
||||
# Copy and install requirements
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# Copy the package contents
|
||||
COPY bot bot
|
||||
# Copy the package contents and change ownership
|
||||
COPY --chown=appuser:appuser bot bot
|
||||
|
||||
# Switch to the non-root user
|
||||
USER appuser
|
||||
|
||||
# Add a basic health check
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
||||
CMD python3 -c "import os; exit(0) if os.path.exists('bot/main.py') else exit(1)"
|
||||
|
||||
# Run the bot via the package entrypoint
|
||||
CMD ["python", "-m", "bot.main"]
|
||||
|
||||
Reference in New Issue
Block a user