Skip to content

Commit 979afd8

Browse files
committed
Install project deps before copying src for faster builds
1 parent d89cbdd commit 979afd8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ RUN apt-get update && apt-get install -y make
44

55
WORKDIR /sdk
66

7-
COPY Makefile pyproject.toml vars.mk ./
7+
COPY Makefile pyproject.toml vars.mk uv.lock ./
8+
9+
# Run before `COPY src src` to cache dependencies for faster iterative builds
10+
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip make docker-deps
811

912
COPY .git .git
1013
COPY src src

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include vars.mk
22

33
.DEFAULT_GOAL := all
44

5-
.PHONY: build clean cov default dev docs ensure-uv fmt fix install it lint test uninstall version help
5+
.PHONY: build clean cov default dev docker-deps docs ensure-uv fmt fix install it lint test uninstall version help
66

77
all: dev test lint build
88

@@ -32,6 +32,12 @@ cov-xml: dev
3232
dev: ensure-uv
3333
$(UV) pip install -e .
3434

35+
docker-deps: ensure-uv
36+
# Sync given the `uv.lock` file
37+
# --frozen : assert that the lock file exists
38+
# --no-install-project : do not install the project itself, but install its dependencies
39+
$(UV) sync --frozen --no-install-project
40+
3541
docs: ensure-uv
3642
$(MAKE) -C ./docs
3743

0 commit comments

Comments
 (0)