Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fix docker volume mounts (#3710)

Peter Petermann479c7468b46d
diff --git a/Dockerfile b/Dockerfile
index 6023cefac6..d32d4a667d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -36,5 +36,7 @@ RUN sed -i '/Items below this point will not be included in the Docker Image/,$d
pip install --no-cache-dir -r requirements.txt
WORKDIR /app
ONBUILD COPY autogpt/ ./autogpt
+ONBUILD COPY scripts/ ./scripts
+
FROM autogpt-${BUILD_TYPE} AS auto-gpt
diff --git a/autogpt/utils.py b/autogpt/utils.py
index 112a15080c..6a3ef0ae78 100644
--- a/autogpt/utils.py
+++ b/autogpt/utils.py
@@ -109,10 +109,12 @@ def get_current_git_branch() -> str:
def get_latest_bulletin() -> tuple[str, bool]:
- exists = os.path.exists("CURRENT_BULLETIN.md")
+ exists = os.path.exists("data/CURRENT_BULLETIN.md")
current_bulletin = ""
if exists:
- current_bulletin = open("CURRENT_BULLETIN.md", "r", encoding="utf-8").read()
+ current_bulletin = open(
+ "data/CURRENT_BULLETIN.md", "r", encoding="utf-8"
+ ).read()
new_bulletin = get_bulletin_from_web()
is_new_news = new_bulletin != "" and new_bulletin != current_bulletin
@@ -125,7 +127,7 @@ def get_latest_bulletin() -> tuple[str, bool]:
)
if new_bulletin and is_new_news:
- open("CURRENT_BULLETIN.md", "w", encoding="utf-8").write(new_bulletin)
+ open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8").write(new_bulletin)
current_bulletin = f"{Fore.RED}::NEW BULLETIN::{Fore.RESET}\n\n{new_bulletin}"
return f"{news_header}\n{current_bulletin}", is_new_news
diff --git a/data/.keep b/data/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs/setup.md b/docs/setup.md
index d0917c8bfc..c49749149d 100644
--- a/docs/setup.md
+++ b/docs/setup.md
@@ -54,9 +54,15 @@ Get your OpenAI API key from: [https://platform.openai.com/account/api-keys](htt
environment:
MEMORY_BACKEND: ${MEMORY_BACKEND:-redis}
REDIS_HOST: ${REDIS_HOST:-redis}
- volumes:
- - ./:/app
profiles: ["exclude-from-up"]
+ volumes:
+ - ./auto_gpt_workspace:/app/auto_gpt_workspace
+ - ./data:/app/data
+ ## allow auto-gpt to write logs to disk
+ - ./logs:/app/logs
+ ## uncomment following lines if you have / want to make use of these files
+ #- ./azure.yaml:/app/azure.yaml
+ #- ./ai_settings.yaml:/app/ai_settings.yaml
redis:
image: "redis/redis-stack-server:latest"
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 5b4d181c15..f9ab36987e 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -85,8 +85,8 @@ def test_get_bulletin_from_web_exception(mock_get):
def test_get_latest_bulletin_no_file():
- if os.path.exists("CURRENT_BULLETIN.md"):
- os.remove("CURRENT_BULLETIN.md")
+ if os.path.exists("data/CURRENT_BULLETIN.md"):
+ os.remove("data/CURRENT_BULLETIN.md")
bulletin, is_new = get_latest_bulletin()
assert is_new
@@ -94,7 +94,7 @@ def test_get_latest_bulletin_no_file():
def test_get_latest_bulletin_with_file():
expected_content = "Test bulletin"
- with open("CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
+ with open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
f.write(expected_content)
with patch("autogpt.utils.get_bulletin_from_web", return_value=""):
@@ -102,11 +102,11 @@ def test_get_latest_bulletin_with_file():
assert expected_content in bulletin
assert is_new == False
- os.remove("CURRENT_BULLETIN.md")
+ os.remove("data/CURRENT_BULLETIN.md")
def test_get_latest_bulletin_with_new_bulletin():
- with open("CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
+ with open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
f.write("Old bulletin")
expected_content = "New bulletin from web"
@@ -116,12 +116,12 @@ def test_get_latest_bulletin_with_new_bulletin():
assert expected_content in bulletin
assert is_new
- os.remove("CURRENT_BULLETIN.md")
+ os.remove("data/CURRENT_BULLETIN.md")
def test_get_latest_bulletin_new_bulletin_same_as_old_bulletin():
expected_content = "Current bulletin"
- with open("CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
+ with open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8") as f:
f.write(expected_content)
with patch("autogpt.utils.get_bulletin_from_web", return_value=expected_content):
@@ -129,7 +129,7 @@ def test_get_latest_bulletin_new_bulletin_same_as_old_bulletin():
assert expected_content in bulletin
assert is_new == False
- os.remove("CURRENT_BULLETIN.md")
+ os.remove("data/CURRENT_BULLETIN.md")
@skip_in_ci