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

feature: add docker support #39

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# exclude
.*
Dockerfile

# include
!.env
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use an official Python base image from the Docker Hub
FROM python:3-alpine AS loopgpt-base

# Install browsers
RUN apk update && apk add --no-cache \
firefox \
ca-certificates

# Install utilities
RUN apk add --no-cache curl jq wget git gcc g++ libc-dev bash

# Set environment variables
ENV PIP_NO_CACHE_DIR=yes \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

RUN adduser -D -g gpt -s /bin/bash gpt

WORKDIR /app
COPY requirements.txt setup.py ./
RUN chown -R gpt:gpt . && chmod -R 755 .

USER gpt:gpt

RUN pip install --user -e .

COPY --chown=gpt:gpt . ./

ENV DISPLAY=:99 \
PATH=/home/gpt/.local/bin:$PATH
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ cd loopgpt
pip install -e .
```

### Install from source (dev) using Docker
```bash
git clone https://github.com/farizrahman4u/loopgpt.git@main
cd loopgpt
docker build -t loopgpt:local-dev .
```

## 🏎️ Getting Started

### Setup your OpenAI API Key 🔑
Expand Down Expand Up @@ -143,6 +150,19 @@ loopgpt run

Run `loopgpt --help` to see all the available options.

### 🐋 Docker Mode

You can run L♾️pGPT in the previously mentioned modes, using Docker:

```bash
# CLI mode
docker run -i --rm loopgpt:local-dev loopgpt run

# Script mode example
docker run -i --rm -v "$(pwd)/scripts:/scripts" loopgpt:local-dev python /scripts/myscript.py

```

## ⚒️ Adding custom tools ⚒️

L♾️pGPT agents come with a set of builtin tools which allows them to perform various basic tasks such as searching the web, filesystem operations, etc. You can view these tools with `print(agent.tools)`.
Expand Down