Helion-OSC / Dockerfile
Trouter-Library's picture
Create Dockerfile
5f08f98 verified
# Helion-OSC Docker Image
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
git \
wget \
curl \
vim \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip
RUN pip3 install --upgrade pip setuptools wheel
# Set working directory
WORKDIR /app
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# Install additional dependencies for API server
RUN pip3 install --no-cache-dir \
fastapi \
uvicorn[standard] \
pydantic \
python-multipart
# Copy application files
COPY . .
# Create directories for models and cache
RUN mkdir -p /app/models /app/cache /app/outputs
# Set Hugging Face cache directory
ENV HF_HOME=/app/cache
ENV TRANSFORMERS_CACHE=/app/cache
# Expose port for API server
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Default command (can be overridden)
CMD ["python3", "api_server.py", "--host", "0.0.0.0", "--port", "8000"]