57 lines
2.1 KiB
Text
57 lines
2.1 KiB
Text
# ============================================================================
|
||
# FlyGuard GPU: NVIDIA RTX / CUDA 12 Production Image (Кейс 05, ЛЦТ-2026)
|
||
# Архитектура: Ada Lovelace (RTX 4070 Ti Super 16GB) / Ampere / Turing
|
||
# Полная совместимость с Dockerfile (Stage: production)
|
||
# ============================================================================
|
||
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 AS production
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive \
|
||
PYTHONUNBUFFERED=1 \
|
||
PYTHONDONTWRITEBYTECODE=1 \
|
||
PYTHONPATH="/app:/app/tools" \
|
||
FLYGUARD_DATA="/data" \
|
||
FLYGUARD_DEVICE="auto" \
|
||
NVIDIA_VISIBLE_DEVICES=all \
|
||
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||
|
||
# Install Python 3.11, pip, and system dependencies
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
software-properties-common \
|
||
ca-certificates \
|
||
libgomp1 \
|
||
curl \
|
||
&& add-apt-repository -y ppa:deadsnakes/ppa \
|
||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||
python3.11 \
|
||
python3.11-distutils \
|
||
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
|
||
&& ln -sf /usr/bin/python3.11 /usr/bin/python3 \
|
||
&& ln -sf /usr/bin/python3.11 /usr/bin/python \
|
||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
||
# Create non-root user and directories
|
||
RUN useradd -m -u 1000 -s /bin/bash flyguard && \
|
||
mkdir -p /app /data /app/artifacts && \
|
||
chown -R flyguard:flyguard /app /data
|
||
|
||
WORKDIR /app
|
||
|
||
# Cache layer: copy only requirements first
|
||
COPY --chown=flyguard:flyguard requirements-gpu.txt /app/
|
||
|
||
# Install python dependencies with PyTorch CUDA 12
|
||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
||
pip install --no-cache-dir -r requirements-gpu.txt
|
||
|
||
# Copy application source code
|
||
COPY --chown=flyguard:flyguard . /app/
|
||
RUN chmod +x /app/docker-entrypoint.sh
|
||
|
||
USER flyguard
|
||
VOLUME ["/data", "/app/artifacts"]
|
||
|
||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||
CMD python3 -c "import flyguard; from flyguard.device import get_device_info; print('healthy', get_device_info())" || exit 1
|
||
|
||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||
CMD ["default"]
|