DummyApp/Dockerfile

26 lines
741 B
Text
Raw Normal View History

2026-08-04 16:52:09 +03:00
FROM python:3.12-slim
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
# Установка curl для healthcheck
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
2026-08-04 16:39:49 +03:00
WORKDIR /app
COPY requirements.txt .
2026-08-04 16:52:09 +03:00
RUN pip install --no-cache-dir -r requirements.txt
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
COPY . .
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
# Создаем non-root пользователя
2026-08-04 16:39:49 +03:00
RUN groupadd -r appuser && useradd -r -g appuser appuser
2026-08-04 16:52:09 +03:00
USER appuser
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
EXPOSE 5000
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD curl -f http://localhost:5000/health || exit 1
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
# Вариант 1: Запуск через Python
CMD ["python", "-c", "from main import app; app.run(host='0.0.0.0', port=5000)"]
2026-08-04 16:39:49 +03:00
2026-08-04 16:52:09 +03:00
# Вариант 2: Если используете gunicorn
# CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"]