File size: 1,166 Bytes
02532a9 |
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 |
FROM huggingface/transformers-pytorch-gpu:latest
# Set basic environment variables
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Install Python requirements
RUN pip install --no-cache-dir gradio==3.38.0 pillow numpy
# Copy diagnostic script
COPY gpu_test.py /app/
# Add a script to check GPU status at startup
RUN echo '#!/bin/bash \n\
echo "==== GPU DIAGNOSTICS STARTUP CHECKS ====" \n\
echo "Checking NVIDIA driver and CUDA:" \n\
nvidia-smi || echo "nvidia-smi failed - GPU may not be properly configured" \n\
echo "Current GPU-related environment variables:" \n\
echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}" \n\
echo "NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}" \n\
echo "==== STARTING APPLICATION ====" \n\
exec "$@"' > /entrypoint.sh && \
chmod +x /entrypoint.sh
# Make port 7860 available for the app
EXPOSE 7860
# Use our entrypoint script to check GPU status before starting the app
ENTRYPOINT ["/entrypoint.sh"]
# Start the application
CMD ["python", "gpu_test.py"] |