From 8f502ba7ad74f62bd2570ac1f2b4cda130e4dabe Mon Sep 17 00:00:00 2001 From: MurdieX Date: Mon, 17 Jul 2023 00:23:42 +0100 Subject: [PATCH 1/4] Added Docker support. --- Dockerfile | 12 ++++++++++++ README.md | 24 ++++++++++++++++++++++++ docker-compose.yml | 19 +++++++++++++++++++ entrypoint.sh | 14 ++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..dd81969641 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-slim + +RUN apt-get update \ + && apt-get install -y sudo + +WORKDIR /app + +COPY . . + +RUN sudo pip install -e . + +ENTRYPOINT ["bash", "/app/entrypoint.sh"] diff --git a/README.md b/README.md index c42f491d17..10b1123f48 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,30 @@ To **run in the browser** you can simply: [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/AntonOsika/gpt-engineer/codespaces) +## Getting Started using Docker + +**Running using docker cli**: + +Building the image: +- `git clone https://github.com/AntonOsika/gpt-engineer.git` +- `cd gpt-engineer` +- `docker build --rm -t gpt-engineer .` + +Running the container: +- `docker run -it --rm -e OPENAI_API_KEY="YOUR" -v ./wallpheaven-generator:/project gpt-engineer` + +The `-v` flag mounts the `your-project` folder into the container. Make sure to have a `prompt` file in there. + +**Running using docker-compose cli**: + +Building the image: +- `git clone https://github.com/AntonOsika/gpt-engineer.git` +- `cd gpt-engineer` +- `docker-compose build` +- `docker-compose run --rm gpt-engineer` + +Set the OPENAI_API_KEY in 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. + ## Features diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..1e92f05776 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3" + +services: + gpt-engineer: + build: + context: . + dockerfile: Dockerfile + stdin_open: true + tty: true + # Set the API key from the .env file + env_file: + - .env + ## OR set the API key directly + # environment: + # - OPENAI_API_KEY="YOUR_API_KEY_HERE" + image: gpt-engineer + volumes: + - ./projects/example:/project + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000000..6c6228ce58 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash +project_dir="/project" + +# Run the gpt engineer script +gpt-engineer $project_dir "$@" + +# Patch the permissions of the generated files to be owned by nobody except prompt file +for item in "$project_dir"/*; do + if [[ "$item" != "$project_dir/prompt" ]]; then + chown -R nobody:nogroup "$item" + chmod -R 777 "$item" + fi +done + From d2b65df91e79fd629bbc9aede8ccd36f71739b0b Mon Sep 17 00:00:00 2001 From: MurdieX Date: Mon, 17 Jul 2023 00:27:00 +0100 Subject: [PATCH 2/4] Fixed a typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10b1123f48..26e4b82de8 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Building the image: - `docker build --rm -t gpt-engineer .` Running the container: -- `docker run -it --rm -e OPENAI_API_KEY="YOUR" -v ./wallpheaven-generator:/project gpt-engineer` +- `docker run -it --rm -e OPENAI_API_KEY="YOUR OPENAI KEY" -v ./wallpheaven-generator:/project gpt-engineer` The `-v` flag mounts the `your-project` folder into the container. Make sure to have a `prompt` file in there. From 40c0294409d1f7fb745a6640d5d7d5ddbc73f856 Mon Sep 17 00:00:00 2001 From: MurdieX Date: Mon, 17 Jul 2023 00:35:30 +0100 Subject: [PATCH 3/4] Added .dockerignore --- .dockerignore | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..58b0fc0985 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,60 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Distribution / packaging +dist/ +build/ +*.egg-info/ +*.egg + +# Virtual environments +.env +.env.sh +venv/ +ENV/ + +# IDE-specific files +.vscode/ +.idea/ + +# Compiled Python modules +*.pyc +*.pyo +*.pyd + +# Python testing +.pytest_cache/ +.ruff_cache/ +.coverage +.mypy_cache/ + +# macOS specific files +.DS_Store + +# Windows specific files +Thumbs.db + +# this application's specific files +archive + +# any log file +*log.txt +todo +scratchpad + +# Ignore GPT Engineer files +projects +!projects/example + +# Pyenv +.python-version + +# Benchmark files +benchmark +!benchmark/*/prompt + +.gpte_consent From 0c0f7f56dfc3ba7cbee82546501f80ea14b5591b Mon Sep 17 00:00:00 2001 From: Ayoub Fletcher <11021965+ayoubfletcher@users.noreply.github.com> Date: Tue, 18 Jul 2023 00:24:06 +0100 Subject: [PATCH 4/4] Update README.md Co-authored-by: karlderkaefer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26e4b82de8..a59ef8f86b 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Building the image: - `docker build --rm -t gpt-engineer .` Running the container: -- `docker run -it --rm -e OPENAI_API_KEY="YOUR OPENAI KEY" -v ./wallpheaven-generator:/project gpt-engineer` +- `docker run -it --rm -e OPENAI_API_KEY="YOUR OPENAI KEY" -v ./your-project:/project gpt-engineer` The `-v` flag mounts the `your-project` folder into the container. Make sure to have a `prompt` file in there.