test runner - fix v7
This commit is contained in:
parent
47cbbc92cf
commit
fa10819073
2 changed files with 19 additions and 7 deletions
|
|
@ -71,6 +71,15 @@ jobs:
|
||||||
git clone https://vicsergeev.ru/forgejo/Vic/DummyApp.git .
|
git clone https://vicsergeev.ru/forgejo/Vic/DummyApp.git .
|
||||||
git checkout ${{ github.sha }}
|
git checkout ${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Install Docker CLI
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y ca-certificates curl
|
||||||
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz -o docker.tgz
|
||||||
|
tar xzf docker.tgz --strip-components=1 -C /usr/bin docker/docker
|
||||||
|
rm docker.tgz
|
||||||
|
docker --version
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
|
|
||||||
17
Dockerfile
17
Dockerfile
|
|
@ -1,20 +1,23 @@
|
||||||
# Многоступенчатая сборка для оптимизации
|
# Многоступенчатая сборка для оптимизации
|
||||||
FROM python:3.14-slim as builder
|
FROM python:3.12-slim as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Устанавливаем системные зависимости (если нужны для сборки)
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Устанавливаем зависимости
|
# Устанавливаем зависимости
|
||||||
COPY requirements.txt .
|
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
|
WORKDIR /app
|
||||||
|
|
||||||
# Копируем зависимости из builder
|
# Копируем зависимости из builder
|
||||||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
COPY --from=builder /root/.local /root/.local
|
||||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
|
|
||||||
# Копируем код приложения
|
# Копируем код приложения
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
@ -26,9 +29,9 @@ USER appuser
|
||||||
# Экспортируем порт
|
# Экспортируем порт
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Health check
|
# Health check (requests должен быть в requirements.txt!)
|
||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
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
|
# Запускаем через gunicorn
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "run:app"]
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "run:app"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue