Enhance caching mechanism and logging configuration
- Updated .gitignore to include additional IDE and OS files, as well as log and web build directories. - Expanded config.sample.yaml to include cache configuration options for memory and Redis. - Modified wallamonitor.py to load cache configuration and initialize ArticleCache. - Refactored QueueManager to utilize ArticleCache for tracking notified articles. - Improved logging setup to dynamically determine log file path based on environment.
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Instalar dependencias del sistema necesarias para compilar paquetes Python
|
||||
# Separar los comandos para mejor debugging y manejo de errores
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
gcc \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
pkg-config; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
apt-get clean
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiar requirements primero para aprovechar cache de Docker
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copiar el resto del código
|
||||
COPY . .
|
||||
|
||||
# El archivo config.yaml se genera automáticamente desde config.sample.yaml en el primer arranque
|
||||
# En Docker, se recomienda montar config.yaml como volumen para gestionar la configuración fuera de la imagen.
|
||||
|
||||
# Healthcheck simple (verifica que el proceso esté ejecutándose)
|
||||
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD pgrep -f "python.*wallamonitor.py" || exit 1
|
||||
|
||||
CMD ["python", "wallamonitor.py"]
|
||||
Reference in New Issue
Block a user