BUH_bot/Dockerfile
Игорь Надеин b75b8e62a6 feat: Add Docker containerization for development
- Add Dockerfile with Python 3.11-slim base
- Add docker-compose.yml for local development
- Add .dockerignore to optimize build context
- Add start/stop scripts for Linux and Windows
- Add .env.example template
- Configure volumes for data, logs, temp_documents
- Add healthcheck with 30s interval
- Resource limits: 0.5 CPU, 512MB RAM
2025-11-03 14:20:26 +03:00

47 lines
1.4 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Используем официальный Python образ
FROM python:3.11-slim
# Метаданные
LABEL maintainer="BUH_bot"
LABEL description="Telegram бот для работы с МойСклад"
# Устанавливаем рабочую директорию
WORKDIR /app
# Устанавливаем системные зависимости
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libxml2-dev \
libxslt1-dev \
&& rm -rf /var/lib/apt/lists/*
# Копируем файл зависимостей
COPY requirements.txt .
# Устанавливаем Python зависимости
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Копируем код приложения
COPY . .
# Создаём директории для данных
RUN mkdir -p /app/data /app/temp_documents /app/logs
# Переменные окружения по умолчанию
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DATA_DIR=/app/data \
LOGS_DIR=/app/logs
# Volumes для персистентных данных
VOLUME ["/app/data", "/app/logs", "/app/temp_documents"]
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import sys; sys.exit(0)"
# Запуск бота
CMD ["python", "-u", "bot.py"]