File size: 1,282 Bytes
7c3c32d 34e8992 c602015 7c3c32d c602015 34e8992 52506ec 34e8992 1cb4bfb f021e7d 1cb4bfb 83e5626 34e8992 c602015 34e8992 a475949 2e3b478 a475949 34e8992 03fe486 |
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 |
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ca-certificates \
libgl1-mesa-glx \
libegl1-mesa \
libfontconfig1 \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# --- Define cache directory early for clarity ---
ARG HF_CACHE_DIR_ARG=/app/.cache
ENV HF_HOME=${HF_CACHE_DIR_ARG}
ENV HF_DATASETS_CACHE=${HF_CACHE_DIR_ARG}/datasets
ENV TRANSFORMERS_CACHE=${HF_CACHE_DIR_ARG}/transformers
# Create the cache directories and make them writable
RUN mkdir -p ${HF_DATASETS_CACHE} && chmod -R 777 ${HF_CACHE_DIR_ARG}
COPY setup.sh .
COPY requirements.txt .
COPY app.py .
COPY src/ ./src/
RUN chmod +x setup.sh && ./setup.sh
# make the directories
RUN mkdir -p /app/local_hf_downloads && chmod 777 /app/local_hf_downloads
RUN mkdir -p /app/temp_dir_for_exec_code && chmod 777 /app/temp_dir_for_exec_code
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Environment variables for MiniZinc
ENV MZN_DIR=/opt/minizinc
ENV PATH="${MZN_DIR}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${MZN_DIR}/lib:${LD_LIBRARY_PATH}"
ENV QT_PLUGIN_PATH="${MZN_DIR}/plugins:${QT_PLUGIN_PATH}"
# Expose the port Gradio runs on
EXPOSE 7860
CMD ["python", "app.py"] |