From 1799c94953e6ab62577bd1090cdf7c600f05d5b6 Mon Sep 17 00:00:00 2001 From: Drew Cain Date: Wed, 14 Jan 2026 11:59:35 -0600 Subject: [PATCH] fix: Docker container Python symlink broken at runtime (#510) Signed-off-by: Drew Cain Co-authored-by: Claude Opus 4.5 --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 361ddbba..ffb030fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,13 @@ ARG GID=1000 COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # Set environment variables +# UV_PYTHON_INSTALL_DIR ensures Python is installed to a persistent location +# that survives in the final image (not in /root/.local which gets lost) +# UV_PYTHON_PREFERENCE=only-managed tells uv to use its managed Python version ENV PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 + PYTHONDONTWRITEBYTECODE=1 \ + UV_PYTHON_INSTALL_DIR=/python \ + UV_PYTHON_PREFERENCE=only-managed # Create a group and user with the provided UID/GID # Check if the GID already exists, if not create appgroup @@ -19,9 +24,10 @@ RUN (getent group ${GID} || groupadd --gid ${GID} appgroup) && \ # Copy the project into the image ADD . /app -# Sync the project into a new environment, asserting the lockfile is up to date +# Install Python 3.13 explicitly and sync the project WORKDIR /app -RUN uv sync --locked +RUN uv python install 3.13 +RUN uv sync --locked --python 3.13 # Create necessary directories and set ownership RUN mkdir -p /app/data/basic-memory /app/.basic-memory && \ @@ -43,4 +49,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD basic-memory --version || exit 1 # Use the basic-memory entrypoint to run the MCP server with default SSE transport -CMD ["basic-memory", "mcp", "--transport", "sse", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file +CMD ["basic-memory", "mcp", "--transport", "sse", "--host", "0.0.0.0", "--port", "8000"]