Axon / Dockerfile
AIencoder's picture
Update Dockerfile
7c048c0 verified
raw
history blame
1.58 kB
# Force rebuild 1
# Use Python 3.11 for compatibility (Matches your wheels)
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libopenblas-dev \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# --- FIX STARTS HERE ---
# Create cache directories on /data and matplotlib config dir
RUN mkdir -p \
/data/.huggingface \
/data/.cache/huggingface/datasets \
/data/.cache/huggingface/transformers \
/tmp/matplotlib \
&& chmod -R 777 /data /tmp/matplotlib
# Clean any old Hugging Face caches (defensive)
RUN rm -rf \
/root/.cache/huggingface \
/root/.cache/huggingface_hub \
/root/.cache/huggingface/datasets || true
# Set cache environment variables to point at /data
ENV HF_HOME=/data/.huggingface
ENV HF_HUB_CACHE=/data/.cache/huggingface/hub
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
ENV MPLCONFIGDIR=/tmp/matplotlib
# --- FIX ENDS HERE ---
# Copy requirements file
COPY requirements.txt /app/requirements.txt
# Install dependencies
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Install PyTorch separately for compatibility
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy application files
COPY . /app
# Expose port
EXPOSE 7860
# --- CRITICAL FIX: Run the entrypoint script first ---
ENTRYPOINT ["/entrypoint.sh"]
# Run the application
CMD ["python", "app.py"]