autotrain-advanced / Dockerfile
thenewfolder's picture
Optimize AutoTrain: 10x faster startup, multi-worker, health checks
13025d4
Raw
History Blame Contribute Delete
772 Bytes
# 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}