Stabilize staff concurrency and premium emoji; enable verified Drone deployment
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2026-09-13 19:48:41 +09:00
parent 733298bf06
commit cb35bb12e3
86 changed files with 2993 additions and 2455 deletions

View File

@@ -1,5 +1,5 @@
# Multi-stage build для оптимизации размера образа
FROM python:3.12-slim as builder
FROM python:3.12-slim-bookworm AS builder
# Устанавливаем системные зависимости
RUN apt-get update && apt-get install -y \
@@ -18,14 +18,19 @@ RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Производственный образ
FROM python:3.12-slim
FROM python:3.12-slim-bookworm
# Создаем пользователя для безопасности
RUN groupadd -r lottery && useradd -r -g lottery lottery
# Устанавливаем необходимые системные пакеты
RUN apt-get update && apt-get install -y \
curl \
# Match the production PostgreSQL major version so backups can be restored there.
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
&& install -d /usr/share/postgresql-common/pgdg \
&& curl --fail --silent --show-error https://www.postgresql.org/media/keys/ACCC4CF8.asc \
-o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
&& echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main' \
> /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y --no-install-recommends postgresql-client-16 \
&& rm -rf /var/lib/apt/lists/*
# Копируем виртуальное окружение из builder
@@ -36,7 +41,10 @@ ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /app
# Копируем файлы приложения
COPY --chown=lottery:lottery . .
COPY --chown=lottery:lottery src/ ./src/
COPY --chown=lottery:lottery migrations/ ./migrations/
COPY --chown=lottery:lottery scripts/ ./scripts/
COPY --chown=lottery:lottery main.py alembic.ini ./
# Создаем необходимые директории
RUN mkdir -p /app/logs /app/data && \
@@ -52,7 +60,7 @@ ENV PYTHONPATH="/app" \
# Проверяем здоровье приложения
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "from src.core.database import async_session_maker; import asyncio; asyncio.run(async_session_maker().__aenter__())" || exit 1
CMD python -m src.core.health
# Открываем порт для мониторинга (если потребуется)
EXPOSE 8000
@@ -64,4 +72,4 @@ CMD ["python", "main.py"]
LABEL maintainer="Lottery Bot Team" \
version="1.0.0" \
description="Telegram Bot for Lottery Management" \
org.opencontainers.image.source="https://github.com/your-repo/lottery-bot"
org.opencontainers.image.source="https://git.smartsoltech.kr/trevor/new_lottery_bot"