Spaces:
Sleeping
Sleeping
WilliamGazeley
commited on
Commit
·
06b11bc
1
Parent(s):
cec1525
Start Ollama server in container
Browse files- Dockerfile +11 -11
Dockerfile
CHANGED
@@ -28,33 +28,33 @@ RUN apt-get update && \
|
|
28 |
|
29 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
30 |
ARG OLLAMA_MODEL
|
31 |
-
COPY ollama_init.sh .
|
32 |
-
RUN chmod +x ollama_init.sh
|
33 |
-
RUN ./ollama_init.sh ${OLLAMA_MODEL}
|
34 |
|
35 |
RUN useradd -m -u 1000 user
|
36 |
USER user
|
37 |
ENV HOME=/home/user \
|
38 |
-
|
39 |
WORKDIR ${HOME}/app
|
40 |
|
41 |
RUN curl https://pyenv.run | bash
|
42 |
ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}
|
43 |
ARG PYTHON_VERSION=3.10.12
|
44 |
RUN pyenv install ${PYTHON_VERSION} && \
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
|
51 |
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && \
|
52 |
pip install flash-attn --no-build-isolation
|
53 |
|
54 |
-
COPY --chown=1000 src ${HOME}/app
|
55 |
-
|
|
|
|
|
56 |
EXPOSE 8501
|
57 |
-
CMD
|
|
|
58 |
--server.headless true \
|
59 |
--server.enableCORS false \
|
60 |
--server.enableXsrfProtection false \
|
|
|
28 |
|
29 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
30 |
ARG OLLAMA_MODEL
|
|
|
|
|
|
|
31 |
|
32 |
RUN useradd -m -u 1000 user
|
33 |
USER user
|
34 |
ENV HOME=/home/user \
|
35 |
+
PATH=/home/user/.local/bin:${PATH}
|
36 |
WORKDIR ${HOME}/app
|
37 |
|
38 |
RUN curl https://pyenv.run | bash
|
39 |
ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}
|
40 |
ARG PYTHON_VERSION=3.10.12
|
41 |
RUN pyenv install ${PYTHON_VERSION} && \
|
42 |
+
pyenv global ${PYTHON_VERSION} && \
|
43 |
+
pyenv rehash && \
|
44 |
+
pip install --no-cache-dir -U pip setuptools wheel && \
|
45 |
+
pip install packaging ninja
|
46 |
|
47 |
COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
|
48 |
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && \
|
49 |
pip install flash-attn --no-build-isolation
|
50 |
|
51 |
+
COPY --chown=1000 src ${HOME}/app
|
52 |
+
|
53 |
+
COPY ollama_init.sh .
|
54 |
+
RUN sh ./ollama_init.sh ${OLLAMA_MODEL}
|
55 |
EXPOSE 8501
|
56 |
+
CMD ollama serve & \
|
57 |
+
streamlit run app.py \
|
58 |
--server.headless true \
|
59 |
--server.enableCORS false \
|
60 |
--server.enableXsrfProtection false \
|