Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash scripts to easily start and stop docker-compose #317

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand All @@ -28,7 +28,5 @@ RUN npm install dalai@0.3.1

RUN npx dalai alpaca setup


# Run the dalai server
CMD [ "npx", "dalai", "serve" ]

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: '3.8'
services:
dalai:
build: .
Expand Down
32 changes: 24 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions start_docker.sh
Original file line number Diff line number Diff line change
@@ -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 runing, please start Docker and try again!"
camigira marked this conversation as resolved.
Show resolved Hide resolved
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
12 changes: 12 additions & 0 deletions stop_docker.sh
Original file line number Diff line number Diff line change
@@ -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 runing, 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