Skip to content

Commit d9b2be1

Browse files
authored
feat: start script (#367)
* feat: start script * make faster
1 parent 3922d8c commit d9b2be1

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

backend/Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@ COPY ./requirements.txt /code/requirements.txt
99

1010
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt --timeout 100
1111

12-
# Install additional dependencies
13-
RUN apt-get install -y liblzma-dev cmake
14-
15-
# Build GPT4All from source (required for GPT4All langchain bindings)
16-
RUN cd /tmp && git clone --recurse-submodules https://github.com/nomic-ai/gpt4all && \
17-
cd gpt4all/gpt4all-backend/ && \
18-
mkdir build && cd build && \
19-
cmake .. && cmake --build . --parallel && \
20-
cd ../../gpt4all-bindings/python && \
21-
pip3 install -e .
12+
#You may need to run `chmod +x ./backend/scripts/start.sh` on your host machine if you get a permission error
13+
COPY ./scripts/start.sh /code/scripts/start.sh
14+
RUN chmod +x /code/scripts/start.sh
2215

2316
COPY . /code/
2417

25-
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050"]
18+
ENTRYPOINT ["/code/scripts/start.sh"]

backend/scripts/start.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Check if gpt4all is already installed
4+
if ! pip show gpt4all > /dev/null; then
5+
if [[ $PRIVATE == "True" ]]; then
6+
apt-get install -y liblzma-dev cmake
7+
8+
cd /tmp && git clone --recurse-submodules https://github.com/nomic-ai/gpt4all
9+
cd gpt4all/gpt4all-backend/
10+
mkdir build && cd build
11+
cmake .. && cmake --build . --parallel
12+
cd ../../gpt4all-bindings/python
13+
pip3 install -e .
14+
fi
15+
fi
16+
17+
# Move to the code directory
18+
cd /code
19+
20+
# Start your app
21+
uvicorn main:app --reload --host 0.0.0.0 --port 5050

0 commit comments

Comments
 (0)