After story 1
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# Base image: CUDA 11.8 runtime on Ubuntu 22.04
|
||||
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
|
||||
|
||||
# Avoid interactive prompts during build
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Etc/UTC
|
||||
|
||||
# System dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# Python
|
||||
python3.10 \
|
||||
python3.10-dev \
|
||||
python3.10-venv \
|
||||
python3-pip \
|
||||
# FFmpeg
|
||||
ffmpeg \
|
||||
# OpenCV dependencies
|
||||
libgl1-mesa-glx \
|
||||
libglib2.0-0 \
|
||||
libsm6 \
|
||||
libxext6 \
|
||||
libxrender-dev \
|
||||
# Utilities
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create non-root user
|
||||
RUN groupadd -g 1000 appuser && \
|
||||
useradd -m -u 1000 -g appuser -s /bin/bash appuser
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Create necessary directories
|
||||
RUN mkdir -p /scratch /models /data/training /data/output /logs
|
||||
|
||||
# Copy requirements first for better caching
|
||||
COPY worker/requirements.txt /app/requirements.txt
|
||||
|
||||
# Create and activate virtual environment
|
||||
RUN python3.10 -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY src/ /app/src/
|
||||
COPY config.yaml /app/config.yaml
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD python3 -c "import torch; assert torch.cuda.is_available()" || exit 1
|
||||
|
||||
# Switch to non-root user
|
||||
USER appuser
|
||||
|
||||
# Default command
|
||||
CMD ["python3", "-m", "src.main"]
|
||||
@@ -0,0 +1,40 @@
|
||||
# Core ML Frameworks
|
||||
torch==2.1.0
|
||||
--extra-index-url https://download.pytorch.org/whl/cu118
|
||||
|
||||
# TensorRT (compatible with CUDA 11.8)
|
||||
# Note: Install from NVIDIA repo or wheel for your specific platform
|
||||
# tensorrt==8.6.1 # Uncomment after verifying compatibility
|
||||
|
||||
# ONNX Runtime with GPU support
|
||||
onnxruntime-gpu==1.16.3
|
||||
|
||||
# Computer Vision
|
||||
opencv-python-headless==4.8.1.78
|
||||
Pillow==10.1.0
|
||||
|
||||
# Database
|
||||
PyMySQL==1.1.0
|
||||
DBUtils==3.1.0
|
||||
|
||||
# Data Processing
|
||||
numpy==1.24.4
|
||||
pandas==2.1.4
|
||||
pyarrow==14.0.0
|
||||
|
||||
# Configuration
|
||||
pyyaml==6.0.1
|
||||
|
||||
# Logging
|
||||
python-json-logger==2.0.7
|
||||
|
||||
# Monitoring
|
||||
prometheus-client==0.19.0
|
||||
|
||||
# Utilities
|
||||
tqdm==4.66.1
|
||||
filelock==3.13.1
|
||||
|
||||
# Testing (dev dependencies - install with [dev] extra)
|
||||
# pytest==7.4.3
|
||||
# pytest-cov==4.1.0
|
||||
Reference in New Issue
Block a user