mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
This commit addresses several pending tasks from Tasks.md and improves the overall quality and security of the codebase. Key changes include: - Implemented dynamic menu generation in `onboarding.py` to create role-based menus from available flows, resolving `[IMP-002]`. - Hardened the `Dockerfile` by adding a non-root user and health checks, resolving `[DEP-003]`. - Fixed a type comparison bug in `identity.py` for the admin ID check, resolving `[BUG-003]`. - Confirmed the fix for the missing `sqlite3` import in `flow_engine.py` and updated `Tasks.md` accordingly, resolving `[BUG-004]`. - Removed unnecessary planning and test files (`plan_de_pruebas.md`, `reparacion_vs_refactor.md`). - Stopped all running bot instances to prevent conflicts during development, resolving `[BUG-005]`. - Updated `Tasks.md` to reflect the completion of all addressed issues.
26 lines
699 B
Docker
26 lines
699 B
Docker
# Python base image
|
|
FROM python:3.11-slim
|
|
|
|
# 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 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"]
|