-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (56 loc) · 1.7 KB
/
Dockerfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=on \
SHELL=/bin/bash
# Create and use the Python venv
WORKDIR /
RUN python3 -m venv --system-site-packages /venv
# Install Torch
ARG INDEX_URL
ARG TORCH_VERSION
ARG XFORMERS_VERSION
RUN source /venv/bin/activate && \
pip3 install --no-cache-dir torch==${TORCH_VERSION} torchvision torchaudio --index-url ${INDEX_URL} && \
pip3 install --no-cache-dir xformers==${XFORMERS_VERSION} --index-url ${INDEX_URL} && \
deactivate
# Clone the git repo of LLaVA and set version
ARG LLAVA_COMMIT
RUN git clone https://github.com/ashleykleynhans/LLaVA.git && \
cd /LLaVA && \
git checkout ${LLAVA_COMMIT}
# Install the dependencies for LLaVA
WORKDIR /LLaVA
RUN source /venv/bin/activate && \
pip3 install --upgrade pip && \
pip3 install wheel && \
pip3 install -e . && \
pip3 install ninja && \
pip3 install flash-attn --no-build-isolation && \
pip3 install transformers==4.37.2 && \
pip3 install protobuf && \
deactivate
# Download the default model
ARG LLAVA_MODEL
ENV MODEL="${LLAVA_MODEL}"
ENV HF_HOME="/"
COPY --chmod=755 scripts/download_models.py /download_models.py
RUN source /venv/bin/activate && \
pip3 install huggingface_hub && \
python3 /download_models.py && \
deactivate
# Remove existing SSH host keys
RUN rm -f /etc/ssh/ssh_host_*
# NGINX Proxy
COPY nginx/nginx.conf /etc/nginx/nginx.conf
# Set template version
ARG RELEASE
ENV TEMPLATE_VERSION=${RELEASE}
# Copy the scripts
WORKDIR /
COPY --chmod=755 scripts/* ./
# Start the container
SHELL ["/bin/bash", "--login", "-c"]
CMD [ "/start.sh" ]