File size: 772 Bytes
13025d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Optimized AutoTrain Advanced Dockerfile
FROM huggingface/autotrain-advanced:7f5ff64

# Install dependencies at build time (not runtime)
RUN pip install -U --no-cache-dir \
    autotrain-advanced \
    hf-transfer \
    sentencepiece \
    protobuf

# Set environment variables for optimization
ENV PYTHONUNBUFFERED=1
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV AUTOTRAIN_CACHE=/tmp/autotrain-cache
ENV GRADIO_ANALYTICS_ENABLED=false

# Create cache directory
RUN mkdir -p $AUTOTRAIN_CACHE

# Expose port
EXPOSE 7860

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

# Run with optimized workers (auto-detect CPU cores)
CMD autotrain app --host 0.0.0.0 --port 7860 --workers ${WORKERS:-2}