File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 8
8
"remoteEnv" : {
9
9
// Allow X11 apps to run inside the container
10
10
"DISPLAY" : " ${localEnv:DISPLAY}" ,
11
- // We put venv on a different volume to cache so have to copy
12
- "UV_LINK_MODE" : " copy" ,
13
11
// Do the equivalent of "activate" the venv so we don't have to "uv run" everything
14
12
"PATH" : " /workspaces/${localWorkspaceFolderBasename}/.venv/bin:${containerEnv:PATH}"
15
13
},
Original file line number Diff line number Diff line change 2
2
# or docker with user namespaces.
3
3
FROM ghcr.io/diamondlightsource/ubuntu-devcontainer:noble AS developer
4
4
5
+ # We will mount in a cache for uv, so silence warnings about it being on a different volume
6
+ ENV UV_LINK_MODE=copy
7
+
8
+ # Cache the python download in the same directory as the uv cache
9
+ ENV UV_PYTHON_CACHE_DIR=/root/.cache/uv/python
10
+
5
11
# Add any system dependencies for the developer/build environment here
6
12
RUN apt-get update && apt-get install -y --no-install-recommends \
7
13
graphviz \
@@ -16,6 +22,9 @@ WORKDIR /app
16
22
COPY . /app
17
23
RUN chmod o+wrX .
18
24
25
+ # Tell uv sync to install python in a known location so we can copy it out later
26
+ ENV UV_PYTHON_INSTALL_DIR=/python
27
+
19
28
# Sync the project without its dev dependencies
20
29
RUN --mount=type=cache,target=/root/.cache/uv \
21
30
uv sync --locked --no-editable --no-dev
@@ -50,6 +59,9 @@ FROM ubuntu:noble AS runtime
50
59
# some-library \
51
60
# && apt-get dist-clean
52
61
62
+ # Copy the python installation from the build stage
63
+ COPY --from=build /python /python
64
+
53
65
# Copy the environment, but not the source code
54
66
COPY --from=build /app/.venv /app/.venv
55
67
ENV PATH=/app/.venv/bin:$PATH
You can’t perform that action at this time.
0 commit comments