33FROM 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
1616COPY . /app
1717RUN 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
2023RUN --mount=type=cache,target=/root/.cache/uv \
2124 uv sync --locked --no-editable --no-dev
@@ -36,6 +39,7 @@ RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
3639# Make editable and debuggable
3740RUN uv pip install debugpy
3841RUN uv pip install -e .
42+ ENV PATH=/app/.venv/bin:$PATH
3943
4044# Alternate entrypoint to allow devcontainer to attach
4145ENTRYPOINT [ "/bin/bash", "-c", "--" ]
@@ -46,10 +50,13 @@ CMD [ "while true; do sleep 30; done;" ]
4650FROM ubuntu:noble AS runtime
4751
4852# Add apt-get system dependecies for runtime here if needed
49- # RUN apt-get update && apt-get install -y --no-install-recommends \
53+ # RUN apt-get update -y && apt-get install -y --no-install-recommends \
5054# some-library \
5155# && apt-get dist-clean
5256
57+ # Copy the python installation from the build stage
58+ COPY --from=build /python /python
59+
5360# Copy the environment, but not the source code
5461COPY --from=build /app/.venv /app/.venv
5562ENV PATH=/app/.venv/bin:$PATH
0 commit comments