Skip to content

Commit 470d4fc

Browse files
committed
fix: container now copies managed python into runtime
1 parent 73c31e3 commit 470d4fc

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"remoteEnv": {
99
// Allow X11 apps to run inside the container
1010
"DISPLAY": "${localEnv:DISPLAY}",
11-
// We put venv on a different volume to cache so have to copy
12-
"UV_LINK_MODE": "copy",
1311
// Do the equivalent of "activate" the venv so we don't have to "uv run" everything
1412
"PATH": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin:${containerEnv:PATH}"
1513
},

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
FROM ghcr.io/diamondlightsource/ubuntu-devcontainer:noble AS developer
44

55
# Add any system dependencies for the developer/build environment here
6-
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
77
graphviz \
88
&& apt-get dist-clean

template/Dockerfile.jinja

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM ghcr.io/diamondlightsource/ubuntu-devcontainer:noble AS developer
44

55
# Add any system dependencies for the developer/build environment here
6-
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
77
graphviz \
88
&& apt-get dist-clean{% if docker %}
99

@@ -16,6 +16,9 @@ WORKDIR /app
1616
COPY . /app
1717
RUN chmod o+wrX .
1818

19+
# Tell uv sync to install python in a known location so we can copy it out later
20+
ENV UV_PYTHON_INSTALL_DIR=/python
21+
1922
# Sync the project without its dev dependencies
2023
RUN --mount=type=cache,target=/root/.cache/uv \
2124
uv sync --locked --no-editable --no-dev
@@ -46,10 +49,13 @@ CMD [ "while true; do sleep 30; done;" ]
4649
FROM ubuntu:noble AS runtime
4750

4851
# Add apt-get system dependecies for runtime here if needed
49-
# RUN apt-get update && apt-get install -y --no-install-recommends \
52+
# RUN apt-get update -y && apt-get install -y --no-install-recommends \
5053
# some-library \
5154
# && apt-get dist-clean
5255

56+
# Copy the python installation from the build stage
57+
COPY --from=build /python /python
58+
5359
# Copy the environment, but not the source code
5460
COPY --from=build /app/.venv /app/.venv
5561
ENV PATH=/app/.venv/bin:$PATH

0 commit comments

Comments
 (0)