test runner - fix v7
This commit is contained in:
parent
47cbbc92cf
commit
fa10819073
2 changed files with 19 additions and 7 deletions
17
Dockerfile
17
Dockerfile
|
|
@ -1,20 +1,23 @@
|
|||
# Многоступенчатая сборка для оптимизации
|
||||
FROM python:3.14-slim as builder
|
||||
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 -r requirements.txt
|
||||
RUN pip install --no-cache-dir --user -r requirements.txt
|
||||
|
||||
# Финальный образ
|
||||
FROM python:3.14-slim
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем зависимости из builder
|
||||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
||||
COPY --from=builder /root/.local /root/.local
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
|
||||
# Копируем код приложения
|
||||
COPY . .
|
||||
|
|
@ -26,9 +29,9 @@ USER appuser
|
|||
# Экспортируем порт
|
||||
EXPOSE 5000
|
||||
|
||||
# Health check
|
||||
# Health check (requests должен быть в requirements.txt!)
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:5000/health')" || exit 1
|
||||
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"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue