struckt
This commit is contained in:
43
app.api/Dockerfile
Normal file
43
app.api/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
||||
# Dockerfile для API сервера
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Устанавливаем рабочую директорию
|
||||
WORKDIR /app
|
||||
|
||||
# Устанавливаем системные зависимости
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Копируем файлы зависимостей
|
||||
COPY requirements.txt* ./
|
||||
COPY pyproject.toml* ./
|
||||
|
||||
# Устанавливаем Python зависимости
|
||||
RUN pip install --no-cache-dir --upgrade pip
|
||||
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
||||
RUN if [ -f pyproject.toml ]; then pip install --no-cache-dir -e .; fi
|
||||
|
||||
# Устанавливаем основные зависимости для FastAPI
|
||||
RUN pip install --no-cache-dir \
|
||||
fastapi \
|
||||
uvicorn[standard] \
|
||||
sqlalchemy \
|
||||
python-multipart \
|
||||
python-dotenv
|
||||
|
||||
# Копируем исходный код
|
||||
COPY . .
|
||||
|
||||
# Создаем директорию для данных
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Экспонируем порт
|
||||
EXPOSE 8000
|
||||
|
||||
# Проверка здоровья
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# Команда запуска
|
||||
CMD ["python", "run_api.py"]
|
||||
Reference in New Issue
Block a user