File size: 1,004 Bytes
aba8087
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install Python ML dependencies
RUN pip install --no-cache-dir \
    torch \
    transformers \
    accelerate \
    bitsandbytes \
    huggingface_hub

# Create directories for model and cache
RUN mkdir -p /app/models /app/cache

# Set environment variables
ENV MODEL_NAME="ai/deepcoder-preview"
ENV MODEL_VARIANT="14B-Q4_K_M"
ENV HUGGINGFACE_HUB_CACHE="/app/cache"
ENV TRANSFORMERS_CACHE="/app/cache"

# Copy application files
COPY requirements.txt .
COPY app.py .
COPY download_model.py .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Expose port for API
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8000/health || exit 1

# Run the application
CMD ["python", "app.py"]