CodeLlama-7b / Dockerfile
Shawn732's picture
5th
ca57b4d
raw
history blame
1.7 kB
# Use an NVIDIA CUDA base image
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}
ENV HOST 0.0.0.0
# Set the working directory in the container to /app
#WORKDIR /app
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
ENV HF_HOME=/app/cache
# Install Python and pip
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
ENV CUDA_DOCKER_ARCH=all
ENV LLAMA_CUBLAS=1
# Copy the current directory contents into the container at /app
COPY . /app
# Install required packages from requirements.txt
COPY ./requirements.txt /app/requirements.txt
RUN pip3 install --no-cache-dir -r /app/requirements.txt
# Expose the ports for FastAPI and Streamlit
EXPOSE 8000
EXPOSE 8501
# Copy and give execute permissions to the start script
COPY start_server.sh /app/start_server.sh
RUN chmod +x /app/start_server.sh
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
WORKDIR /home/user/app
# 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
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . /home/user/app
# Run the start script
#CMD ["/app/start_server.sh"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]