Skip to content

Commit 103368c

Browse files
committed
chore: update Dockerfile and tests for BASIC_MEMORY_PROJECT_ROOT
Updates containerized deployment to use both environment variables for clean project organization and path constraints. ## Dockerfile Changes - Set BASIC_MEMORY_HOME=/app/data/basic-memory (main project location) - Set BASIC_MEMORY_PROJECT_ROOT=/app/data (constrain all projects to volume) - Create /app/data/basic-memory directory Benefits: - Main project cleanly separated in /app/data/basic-memory/ - All projects constrained to /app/data/ (volume mount) - Users can't accidentally create projects outside mounted volume - Consistent with cloud deployment pattern Directory structure: /app/data/ ├── basic-memory/ (main project) │ └── *.md └── other-project/ (optional additional projects) ## Test Fixture Changes - Add config cache invalidation in config_manager fixture - Ensures each test starts with clean config state - Prevents test pollution from cached config values Signed-off-by: phernandez <paul@basicmachines.co>
1 parent fed7075 commit 103368c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ WORKDIR /app
2424
RUN uv sync --locked
2525

2626
# Create necessary directories and set ownership
27-
RUN mkdir -p /app/data /app/.basic-memory && \
27+
RUN mkdir -p /app/data/basic-memory /app/.basic-memory && \
2828
chown -R appuser:${GID} /app
2929

3030
# Set default data directory and add venv to PATH
31-
ENV BASIC_MEMORY_HOME=/app/data \
31+
ENV BASIC_MEMORY_HOME=/app/data/basic-memory \
32+
BASIC_MEMORY_PROJECT_ROOT=/app/data \
3233
PATH="/app/.venv/bin:$PATH"
3334

3435
# Switch to the non-root user

tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def app_config(config_home, tmp_path, monkeypatch) -> BasicMemoryConfig:
7878
def config_manager(
7979
app_config: BasicMemoryConfig, project_config: ProjectConfig, config_home: Path, monkeypatch
8080
) -> ConfigManager:
81+
# Invalidate config cache to ensure clean state for each test
82+
from basic_memory import config as config_module
83+
84+
config_module._CONFIG_CACHE = None
85+
8186
# Create a new ConfigManager that uses the test home directory
8287
config_manager = ConfigManager()
8388
# Update its paths to use the test directory

0 commit comments

Comments
 (0)