Merge pull request #433 from Contribution-Tracking/shell-scripts

refactor: run.sh and run-ollama-docker.sh
This commit is contained in:
Timothy Jaeryang Baek 2024-01-09 13:33:54 -08:00 committed by GitHub
commit 4f1be8eda5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 11 deletions

View file

@ -1,7 +1,19 @@
#!/bin/bash
host_port=11434
container_port=11434
read -r -p "Do you want ollama in Docker with GPU support? (y/n): " use_gpu
docker rm -f ollama || true docker rm -f ollama || true
docker pull ollama/ollama docker pull ollama/ollama:latest
# CPU Only
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama docker_args="-d -v ollama:/root/.ollama -p $host_port:$container_port --name ollama ollama/ollama"
# GPU Support
# docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama if [ "$use_gpu" == "y" ]; then
docker_args+=" --gpus=all"
fi
docker run "$docker_args"
docker image prune -f docker image prune -f

22
run.sh
View file

@ -1,5 +1,19 @@
docker build -t ollama-webui . #!/bin/bash
docker stop ollama-webui || true
docker rm ollama-webui || true image_name="ollama-webui"
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v ollama-webui:/app/backend/data --name ollama-webui --restart always ollama-webui container_name="ollama-webui"
host_port=3000
container_port=8080
docker build -t "$image_name" .
docker stop "$container_name" &>/dev/null || true
docker rm "$container_name" &>/dev/null || true
docker run -d -p "$host_port":"$container_port" \
--add-host=host.docker.internal:host-gateway \
-v "${image_name}:/app/backend/data" \
--name "$container_name" \
--restart always \
"$image_name"
docker image prune -f docker image prune -f