diff --git a/Dockerfile b/Dockerfile index 0d1b3ad..8feb2f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,13 @@ EXPOSE 3000 # Install dependencies RUN apt-get update \ && apt-get install -y \ - build-essential \ - curl \ - g++ \ - git \ - make \ - python3-venv \ - software-properties-common + build-essential \ + curl \ + g++ \ + git \ + make \ + python3-venv \ + software-properties-common # Add NodeSource PPA to get Node.js 18.x RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - @@ -28,7 +28,5 @@ RUN npm install dalai@0.3.1 RUN npx dalai alpaca setup - # Run the dalai server CMD [ "npx", "dalai", "serve" ] - diff --git a/docker-compose.yml b/docker-compose.yml index 893bdfe..68c8435 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.7' +version: '3.8' services: dalai: build: . diff --git a/docs/README.md b/docs/README.md index e236b5d..2fe0ac8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -111,18 +111,34 @@ You do NOT have to install all models, you can install one by one. Let's take a # Quickstart -## Docker compose +## Docker Compose +Requires that you have docker and docker compose installed and running. To verify this, simply run: -Requires that you have docker installed and running. -``` +- `docker version` +- `docker-compose version` + +To run dalai and alpaca, simply run: +- `./start_docker.sh` to start the container and +- Once the container is up and the model has been downloaded, access the site in the browser `http://127.0.0.1:3000/` or simply run in the terminal `open http://127.0.0.1:3000/`. +- `./stop_docker.sh`to stop the container. + +___Note 1: This will dave the models in the `./models` folder.___ + +___Note 2: You can specify a different model by modifying `docker-compose.yml`___ + +**Windows Users** + +Start Container: +```cmd docker compose build -docker compose run dalai npx dalai alpaca install 7B # or a different model -docker compose up -d +docker-compose run --rm dalai npx dalai alpaca install 7B # or a different model +docker-compose -p dalai up -d ``` -This will dave the models in the `./models` folder - -View the site at http://127.0.0.1:3000/ +Stop Container +```cmd +docker-compose -p dalai down +``` ## Mac diff --git a/start_docker.sh b/start_docker.sh new file mode 100755 index 0000000..d5ecb58 --- /dev/null +++ b/start_docker.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check if Docker is running +if ! docker info > /dev/null 2>&1; then + echo "This script uses Docker and is currently not running, please start Docker and try again!" + exit 1 +fi + +# Start dalai alpaca 7B model +docker compose build +docker-compose run --rm dalai npx dalai alpaca install 7B # or a different model +docker-compose -p dalai up -d diff --git a/stop_docker.sh b/stop_docker.sh new file mode 100755 index 0000000..e24192f --- /dev/null +++ b/stop_docker.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +#Check if Docker is running +if ! docker info > /dev/null 2>&1; then + echo "This script uses Docker and is currently not running, please start Docker and try again!" + exit 1 +else + # Start dalai alpaca 7B model + if [ $( docker ps | grep dalai | wc -l ) -gt 0 ]; then + docker-compose -p dalai down + fi +fi