Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca11673

Browse filesBrowse files
committed
Add universal docker image
1 parent 57d8ec3 commit ca11673
Copy full SHA for ca11673

File tree

Expand file treeCollapse file tree

3 files changed

+44
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+44
-0
lines changed

‎Makefile

Copy file name to clipboardExpand all lines: Makefile
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ deploy.gh-docs:
3636
test:
3737
python3 -m pytest
3838

39+
docker:
40+
docker build -t llama-cpp-python:latest -f docker/simple/Dockerfile .
41+
42+
run-server:
43+
uvicorn --factory llama.server:app --host ${HOST} --port ${PORT}
44+
3945
clean:
4046
- cd vendor/llama.cpp && make clean
4147
- cd vendor/llama.cpp && rm libllama.so
@@ -56,4 +62,5 @@ clean:
5662
build.sdist \
5763
deploy.pypi \
5864
deploy.gh-docs \
65+
docker \
5966
clean

‎docker/simple/Dockerfile

Copy file name to clipboard
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Define the image argument and provide a default value
2+
ARG IMAGE=python:3-slim-bullseye
3+
4+
# Use the image as specified
5+
FROM ${IMAGE}
6+
7+
# Re-declare the ARG after FROM
8+
ARG IMAGE
9+
10+
# Update and upgrade the existing packages
11+
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
12+
python3 \
13+
python3-pip \
14+
ninja-build \
15+
build-essential
16+
17+
RUN mkdir /app
18+
WORKDIR /app
19+
COPY . /app
20+
21+
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette
22+
23+
RUN make build && make clean
24+
25+
# Set environment variable for the host
26+
ENV HOST=0.0.0.0
27+
ENV PORT=8000
28+
29+
# Expose a port for the server
30+
EXPOSE 8000
31+
32+
# Run the server start script
33+
CMD ["/bin/sh", "/app/docker/simple/run.sh"]

‎docker/simple/run.sh

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
make build
4+
uvicorn --factory llama_cpp.server.app:create_app --host $HOST --port $PORT

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.