Skip to content

Commit 1906a7e

Browse files
committed
Use uv in Dockerfile
1 parent 9264c04 commit 1906a7e

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

.github/workflows/python-tests.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ jobs:
2121
- name: Install pre-commit
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install pre-commit
24+
pip install uv
25+
uv sync --only-dev
2526
2627
- name: Run pre-commit
2728
run: |
28-
pre-commit run --all-files
29+
uv run pre-commit run --all-files
2930
3031
test:
3132
needs: lint
@@ -56,10 +57,10 @@ jobs:
5657
- name: Install dependencies
5758
run: |
5859
python -m pip install --upgrade pip
59-
pip install -e .[dev]
60+
uv sync --all-extras
6061
6162
- name: Run tests
6263
run: |
63-
pytest --run-api-tests
64+
uv run pytest --run-api-tests
6465
env:
6566
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Dockerfile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
FROM python:3.12-slim
1+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
22

33
WORKDIR /app
44

5+
ENV UV_COMPILE_BYTECODE=1
6+
ENV UV_LINK_MODE=copy
7+
58
# Install system dependencies including build tools
69
RUN apt-get update && apt-get install -y \
710
curl \
@@ -10,12 +13,19 @@ RUN apt-get update && apt-get install -y \
1013
g++ \
1114
&& rm -rf /var/lib/apt/lists/*
1215

13-
# Copy project files
14-
COPY pyproject.toml README.md ./
15-
COPY agent_memory_server ./agent_memory_server
16+
RUN --mount=type=cache,target=/root/.cache/uv \
17+
--mount=type=bind,source=uv.lock,target=uv.lock \
18+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
19+
uv sync --frozen --no-install-project --no-dev
20+
21+
ADD . /app
22+
RUN --mount=type=cache,target=/root/.cache/uv \
23+
uv sync --frozen --no-dev
24+
25+
ENV PATH="/app/.venv/bin:$PATH"
26+
27+
ENTRYPOINT []
1628

17-
# Install Python dependencies
18-
RUN pip install --no-cache-dir -e .
1929

2030
# Run the API server
2131
CMD ["python", "-m", "agent_memory_server.main"]

0 commit comments

Comments
 (0)