Skip to content

Commit 7839eb1

Browse files
committed
Add docker cuda image. Closes #143
1 parent 9e5b6d6 commit 7839eb1

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/build-docker.yaml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,36 @@ jobs:
3636
push: true # push to registry
3737
pull: true # always fetch the latest base images
3838
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
39-
tags: ghcr.io/abetlen/llama-cpp-python:latest
39+
tags: ghcr.io/abetlen/llama-cpp-python:latest
40+
41+
docker-cuda:
42+
name: Build and push Docker image
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
with:
48+
submodules: "true"
49+
50+
- name: Set up QEMU
51+
uses: docker/setup-qemu-action@v2
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v2
55+
56+
- name: Login to GitHub Container Registry
57+
uses: docker/login-action@v2
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.repository_owner }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Build and push
64+
uses: docker/build-push-action@v4
65+
with:
66+
file: Dockerfile.cuda
67+
context: .
68+
push: true # push to registry
69+
pull: true # always fetch the latest base images
70+
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
71+
tags: ghcr.io/abetlen/llama-cpp-python-cuda:latest

Dockerfile.cuda

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM nvidia/cuda:12.1.1-devel-ubuntu20.04
2+
3+
# We need to set the host to 0.0.0.0 to allow outside access
4+
ENV HOST 0.0.0.0
5+
6+
COPY . .
7+
8+
# Install the package
9+
RUN apt update && apt install -y python3 python3-pip
10+
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette
11+
12+
RUN LLAMA_CUBLAS=1 python3 setup.py develop
13+
14+
# Run the server
15+
CMD python3 -m llama_cpp.server

0 commit comments

Comments
 (0)