Skip to content

Commit 1799c94

Browse files
groksrcclaude
andauthored
fix: Docker container Python symlink broken at runtime (#510)
Signed-off-by: Drew Cain <groksrc@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0799618 commit 1799c94

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ ARG GID=1000
88
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
99

1010
# Set environment variables
11+
# UV_PYTHON_INSTALL_DIR ensures Python is installed to a persistent location
12+
# that survives in the final image (not in /root/.local which gets lost)
13+
# UV_PYTHON_PREFERENCE=only-managed tells uv to use its managed Python version
1114
ENV PYTHONUNBUFFERED=1 \
12-
PYTHONDONTWRITEBYTECODE=1
15+
PYTHONDONTWRITEBYTECODE=1 \
16+
UV_PYTHON_INSTALL_DIR=/python \
17+
UV_PYTHON_PREFERENCE=only-managed
1318

1419
# Create a group and user with the provided UID/GID
1520
# Check if the GID already exists, if not create appgroup
@@ -19,9 +24,10 @@ RUN (getent group ${GID} || groupadd --gid ${GID} appgroup) && \
1924
# Copy the project into the image
2025
ADD . /app
2126

22-
# Sync the project into a new environment, asserting the lockfile is up to date
27+
# Install Python 3.13 explicitly and sync the project
2328
WORKDIR /app
24-
RUN uv sync --locked
29+
RUN uv python install 3.13
30+
RUN uv sync --locked --python 3.13
2531

2632
# Create necessary directories and set ownership
2733
RUN mkdir -p /app/data/basic-memory /app/.basic-memory && \
@@ -43,4 +49,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
4349
CMD basic-memory --version || exit 1
4450

4551
# Use the basic-memory entrypoint to run the MCP server with default SSE transport
46-
CMD ["basic-memory", "mcp", "--transport", "sse", "--host", "0.0.0.0", "--port", "8000"]
52+
CMD ["basic-memory", "mcp", "--transport", "sse", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)