Alif-1.0-8B-Instruct / Dockerfile
alishafique's picture
Update Dockerfile
3a4963e verified
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}
# We need to set the host to 0.0.0.0 to allow outside access
ENV HOST 0.0.0.0
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y git build-essential \
python3 python3-pip gcc wget \
ocl-icd-opencl-dev opencl-headers clinfo \
libclblast-dev libopenblas-dev \
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
COPY . .
# setting build related env
# ENV CUDA_DOCKER_ARCH=all
# ENV LLAMA_CUBLAS=1
RUN nvcc --version && python3 --version
# Install depencencies
RUN python3 -m pip install --upgrade pip pytest cmake \
scikit-build setuptools fastapi uvicorn sse-starlette \
pydantic-settings starlette-context gradio==5.18.0 huggingface_hub==0.29.1 hf_transfer
# Install llama-cpp-python (build with cuda)
# RUN CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=75" FORCE_CMAKE=1 python3 -m pip install llama-cpp-python --force-reinstall --upgrade --no-cache-dir --verbose
# RUN python3 -m pip install llama-cpp-python
#RUN python3 -m pip install llama-cpp-python \
# --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
RUN pip install https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-cu121/llama_cpp_python-0.3.4-cp310-cp310-linux_x86_64.whl
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
SYSTEM=spaces
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
CMD ["python3", "app.py"]