|
1 |
| -# Getting Started using Docker |
| 1 | +# Getting Started Using Docker |
2 | 2 |
|
3 |
| -**Running using docker cli**: |
| 3 | +This guide provides step-by-step instructions on how to set up and run the Docker environment for your GPT-Engineer project. |
4 | 4 |
|
5 |
| -Building the image: |
6 |
| -- `git clone https://github.com/gpt-engineer-org/gpt-engineer.git` |
7 |
| -- `cd gpt-engineer` |
8 |
| -- `docker build --rm -t gpt-engineer -f docker/Dockerfile .` |
| 5 | +## Prerequisites |
9 | 6 |
|
10 |
| -Running the container: |
11 |
| -- `docker run -it --rm -e OPENAI_API_KEY="YOUR OPENAI KEY" -v ./your-project:/project gpt-engineer` |
| 7 | +- Docker installed on your machine. |
| 8 | +- Git (for cloning the repository). |
12 | 9 |
|
13 |
| -The `-v` flag mounts the `your-project` folder into the container. Make sure to have a `prompt` file in there. |
| 10 | +## Setup Instructions |
14 | 11 |
|
15 |
| -**Running using docker-compose cli**: |
| 12 | +### Using Docker CLI |
16 | 13 |
|
17 |
| -Building the image: |
18 |
| -- `git clone https://github.com/gpt-engineer-org/gpt-engineer.git` |
19 |
| -- `cd gpt-engineer` |
20 |
| -- `docker-compose -f docker-compose.yml build` |
21 |
| -- `docker-compose run --rm gpt-engineer` |
| 14 | +1. **Clone the Repository** |
22 | 15 |
|
| 16 | + ```bash |
| 17 | + git clone https://github.com/gpt-engineer-org/gpt-engineer.git |
| 18 | + cd gpt-engineer |
| 19 | + ``` |
23 | 20 |
|
24 |
| -Set the OPENAI_API_KEY in docker/docker-compose.yml using .env file or environment variable, and mount your project folder into the container using volumes. for example "./projects/example:/project" ./projects/example is the path to your project folder. |
| 21 | +2. **Build the Docker Image** |
| 22 | + |
| 23 | + ```bash |
| 24 | + docker build --rm -t gpt-engineer -f docker/Dockerfile . |
| 25 | + ``` |
| 26 | + |
| 27 | +3. **Run the Docker Container** |
| 28 | + |
| 29 | + ```bash |
| 30 | + docker run -it --rm -e OPENAI_API_KEY="YOUR_OPENAI_KEY" -v ./your-project:/project gpt-engineer |
| 31 | + ``` |
| 32 | + |
| 33 | + Replace `YOUR_OPENAI_KEY` with your actual OpenAI API key. The `-v` flag mounts your local `your-project` directory inside the container. Replace this with your actual project directory. Ensure this directory contains all necessary files, including the `prompt` file. |
| 34 | + |
| 35 | +### Using Docker Compose |
| 36 | + |
| 37 | +1. **Clone the Repository** (if not already done) |
| 38 | + |
| 39 | + ```bash |
| 40 | + git clone https://github.com/gpt-engineer-org/gpt-engineer.git |
| 41 | + cd gpt-engineer |
| 42 | + ``` |
| 43 | + |
| 44 | +2. **Build and Run using Docker Compose** |
| 45 | + |
| 46 | + ```bash |
| 47 | + docker-compose -f docker-compose.yml build |
| 48 | + docker-compose run --rm gpt-engineer |
| 49 | + ``` |
| 50 | + |
| 51 | + Set the `OPENAI_API_KEY` in the `docker/docker-compose.yml` using an `.env` file or as an environment variable. Mount your project directory to the container using volumes, e.g., `"./projects/example:/project"` where `./projects/example` is the path to your project directory. |
| 52 | + |
| 53 | +3. **Another alternative using Docker Compose** |
| 54 | + |
| 55 | + Since there is only one `docker-compose.yml` file, you could run it without the -f option. |
| 56 | + - `docker compose up -d --build` - To build and start the containers defined in your `docker-compose.yml` file in detached mode |
| 57 | + - `docker compose up -d` - To start the containers defined in your `docker-compose.yml` file in detached mode |
| 58 | + - `docker compose down` - To stop and remove all containers, networks, and volumes associated with the `docker-compose.yml` |
| 59 | + - `docker compose restart` - To restart the containers defined in the `docker-compose.yml` file |
| 60 | + |
| 61 | +## Debugging |
| 62 | + |
| 63 | +To facilitate debugging, you can run a shell inside the built Docker image: |
| 64 | + |
| 65 | +```bash |
| 66 | +docker run -it --entrypoint /bin/bash gpt-engineer |
| 67 | +``` |
| 68 | + |
| 69 | +This opens a shell inside the Docker container, allowing you to execute commands and inspect the environment manually. |
0 commit comments