File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 1+ FROM docker.nix-community.org/nixpkgs/nix-flakes AS builder
2+
3+ # Don't stay in the root directory for this.
4+ # https://github.com/NixOS/nix/issues/11217
5+ WORKDIR /workspace
6+
7+ # Copy just enough for Nix pdm install without bringing in the entire project.
8+ # This ensures we don't run the nix develop too often.
9+ COPY flake.nix flake.lock pyproject.toml pdm.lock .
10+
11+ # Build Nix shell and install all dev PDM dependencies.
12+ RUN nix develop -c pdm install --dev --frozen-lockfile --no-editable
13+
14+ # Copy the rest of the source code.
15+ COPY . .
16+
17+ # Ensure PYTHONPATH contains our current WORKDIR so that the main module can be
18+ # found.
19+ ENV PYTHONPATH="$PYTHONPATH:/workspace"
20+
21+ # Default command is to run the E2E tests, but you may override this with any
22+ # pdm or bash command (e.g., docker run -it <TAG> -- bash).
23+ ENTRYPOINT ["nix", "develop", "-c"]
24+ CMD ["pdm", "run", "test:e2e"]
Original file line number Diff line number Diff line change 6464 ] ;
6565
6666 venvDir = "venv" ;
67+
68+ shellHook = ''
69+ # This isn't needed anywhere except for inside the Dockerfile environment, since we
70+ # try to do `pdm install` without actually having any actual code present for better
71+ # image layering.
72+ export PYTHONPATH="$PYTHONPATH:$PWD"
73+ '' ;
6774 } ;
6875
6976 packages = rec {
Original file line number Diff line number Diff line change @@ -65,8 +65,14 @@ distribution = true
6565[tool .pdm .scripts ]
6666format = " ruff format"
6767lint = " ruff check"
68- test = " pytest tests"
68+
69+ "test" = " pytest tests"
6970"test:e2e" = " pytest e2e"
71+ "test:e2e:docker".composite = [" docker:e2e-test:build" , " docker:e2e-test:run" ]
72+
73+ "docker:e2e-test:build" = " docker build -f Dockerfile.e2e-test -t inference-perf-e2e-test ."
74+ "docker:e2e-test:run" = " docker run --rm -it inference-perf-e2e-test"
75+
7076type-check = " mypy --strict ./inference_perf ./tests"
7177validate = {composite = [" format" , " lint" , " type-check" ]}
7278
You can’t perform that action at this time.
0 commit comments