Skip to content

Commit d5d0110

Browse files
committed
fix: use new Dockerfile for mcp server
1 parent 2e4aab9 commit d5d0110

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

cognee-mcp/Dockerfile

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# Use a Python image with uv pre-installed
22
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
33

4-
# Set build argument
5-
ARG DEBUG
6-
7-
# Set environment variable based on the build argument
8-
ENV DEBUG=${DEBUG}
9-
ENV PIP_NO_CACHE_DIR=true
10-
4+
# Install the project into `/app`
115
WORKDIR /app
126

137
# Enable bytecode compilation
@@ -16,20 +10,27 @@ ENV UV_COMPILE_BYTECODE=1
1610
# Copy from the cache instead of linking since it's a mounted volume
1711
ENV UV_LINK_MODE=copy
1812

19-
RUN apt-get update && apt-get install -y \
20-
gcc \
21-
libpq-dev
13+
# Install the project's dependencies using the lockfile and settings
14+
RUN --mount=type=cache,target=/root/.cache/uv \
15+
--mount=type=bind,source=uv.lock,target=uv.lock \
16+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
17+
uv sync --frozen --no-install-project --no-dev --no-editable
2218

23-
COPY . /app
19+
# Then, add the rest of the project source code and install it
20+
# Installing separately from its dependencies allows optimal layer caching
21+
ADD . /app
22+
RUN --mount=type=cache,target=/root/.cache/uv \
23+
uv sync --frozen --no-dev --no-editable
2424

25-
RUN uv sync --reinstall
25+
FROM python:3.12-slim-bookworm
2626

27-
# Place executables in the environment at the front of the path
28-
ENV PATH="/app:/app/.venv/bin:$PATH"
27+
WORKDIR /app
28+
29+
COPY --from=uv /root/.local /root/.local
30+
COPY --from=uv --chown=app:app /app/.venv /app/.venv
31+
COPY --from=uv --chown=app:app /app/src /app/src
2932

30-
# Set environment variables for MCP server
31-
ENV PYTHONUNBUFFERED=1
32-
ENV MCP_LOG_LEVEL=DEBUG
33-
ENV PYTHONPATH=/app
33+
# Place executables in the environment at the front of the path
34+
ENV PATH="/app/.venv/bin:$PATH"
3435

3536
ENTRYPOINT ["cognee"]

0 commit comments

Comments
 (0)