Spaces:
Sleeping
Sleeping
File size: 1,141 Bytes
5db041c 7a536d9 5db041c 9f83322 5db041c 9f83322 5db041c |
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 |
# Stage 1: Build Cuda toolkit
FROM drakosfire/cuda-base:latest as base-layer
# Llama.cpp requires the ENV variable be set to signal the CUDA build and be built with the CMAKE variables from pip for python use
ENV LLAMA_CUBLAS=1
RUN apt-get update && \
apt-get install -y python3 python3-pip python3-venv && \
pip install gradio && \
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python && \
pip install pillow && \
pip install diffusers && \
pip install accelerate && \
pip install transformers && \
pip install peft && \
pip install pip install PyGithub
FROM base-layer as final-layer
RUN useradd -m -u 1000 user
# Set environment variables for copied builds of cuda and flash-attn in /venv
ENV PATH=/usr/local/cuda-12.4/bin:/venv/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:${LD_LIBRARY_PATH}
ENV VIRTUAL_ENV=/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy local files to working directory and activate user
COPY . /home/user/app/
WORKDIR /home/user/app
USER user
# Set the entrypoint
EXPOSE 8000
ENTRYPOINT ["python", "main.py"] |