test runner - fix v13
All checks were successful
Build and Deploy Flask App / setup (push) Successful in 2s
Build and Deploy Flask App / test (push) Successful in 35s
Build and Deploy Flask App / build-and-push (push) Successful in 1m10s
Build and Deploy Flask App / deploy (push) Successful in 38s

This commit is contained in:
Norvicdev 2026-08-05 09:17:58 +03:00
parent d5720b7cc1
commit f1e3f4defc
2 changed files with 6 additions and 22 deletions

View file

@ -1,37 +1,21 @@
# Многоступенчатая сборка для оптимизации
FROM python:3.12-slim AS builder
WORKDIR /app
# Устанавливаем системные зависимости (если нужны для сборки)
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
# Устанавливаем зависимости
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Финальный образ
FROM python:3.12-slim
WORKDIR /app
# Копируем зависимости из builder
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# Ставим зависимости глобально (доступно всем пользователям)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Копируем код приложения
# Копируем код
COPY . .
# Создаем пользователя для запуска
# Создаём пользователя и даём права на /app
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Экспортируем порт
EXPOSE 5000
# Health check (requests должен быть в requirements.txt!)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5000/health')" || exit 1
# Запускаем через gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "run:app"]