Add docker cuda image. Closes #143

This commit is contained in:
Andrei Betlen 2023-05-03 10:29:05 -04:00
parent 9e5b6d675a
commit 7839eb14d3
2 changed files with 48 additions and 1 deletions

View file

@ -36,4 +36,36 @@ jobs:
push: true # push to registry
pull: true # always fetch the latest base images
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
tags: ghcr.io/abetlen/llama-cpp-python:latest
tags: ghcr.io/abetlen/llama-cpp-python:latest
docker-cuda:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "true"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
file: Dockerfile.cuda
context: .
push: true # push to registry
pull: true # always fetch the latest base images
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
tags: ghcr.io/abetlen/llama-cpp-python-cuda:latest

15
Dockerfile.cuda Normal file
View file

@ -0,0 +1,15 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu20.04
# We need to set the host to 0.0.0.0 to allow outside access
ENV HOST 0.0.0.0
COPY . .
# Install the package
RUN apt update && apt install -y python3 python3-pip
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette
RUN LLAMA_CUBLAS=1 python3 setup.py develop
# Run the server
CMD python3 -m llama_cpp.server