22# or docker with user namespaces.
33# Version SHA has been removed, see: https://github.com/DiamondLightSource/blueapi/issues/1053
44ARG PYTHON_VERSION=3.11
5- FROM python:${PYTHON_VERSION} AS developer
6- COPY --from=ghcr.io/astral-sh/uv:0.7.17 /uv /uvx /bin/
5+ FROM ghcr.io/astral-sh/uv:0.7.19-bookworm AS developer
76
87# Add any system dependencies for the developer/build environment here
98RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -17,23 +16,16 @@ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/s
1716 ./get_helm.sh; \
1817 rm get_helm.sh
1918
20- # Set up a virtual environment and put it in PATH
21- # TODO: uv setup env
22- ENV UV_PROJECT_ENVIRONMENT=/venv
23- # TODO: uv cache
2419RUN mkdir -p /.cache/uv; chmod 777 /.cache/uv
2520ENV UV_CACHE_DIR=/.cache/uv
26- # RUN python -m venv /venv
27- # ENV PATH=/venv/bin:$PATH
21+ RUN SHELL=/usr/bin/bash uv tool update-shell
2822
2923# The build stage installs the context into the venv
3024FROM developer AS build
31- # RUN mkdir -p /.cache/pip; chmod 777 /.cache/pip
25+
3226COPY --chmod=777 . /workspaces/blueapi
3327WORKDIR /workspaces/blueapi
34- # TODO: uv sync
3528RUN uv sync --locked
36- # RUN touch dev-requirements.txt && pip install --upgrade pip && pip install -c dev-requirements.txt .
3729
3830FROM build AS debug
3931
@@ -46,11 +38,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt install libnss-ldapd -y
4638RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
4739
4840# Make editable and debuggable
49- # TODO: uv tool install debugpy
5041RUN uv tool install debugpy
5142RUN uv tool install --editable .
52- # RUN pip install debugpy
53- # RUN pip install -e .
5443
5544# Alternate entrypoint to allow devcontainer to attach
5645ENTRYPOINT [ "/bin/bash" , "-c" , "--" ]
@@ -63,11 +52,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6352 # Git required for installing packages at runtime
6453 git \
6554 && rm -rf /var/lib/apt/lists/*
66- # TODO: Update cache locations
67- COPY --from=build --chmod=777 /venv/ /venv/
6855COPY --from=build --chmod=777 /.cache/uv /.cache/uv
6956COPY --from=build --chmod=777 /workspaces/blueapi /workspaces/blueapi
70- ENV PATH=/venv/bin:$PATH
57+ ENV PATH=/workspaces/blueapi/. venv/bin:$PATH
7158ENV UV_CACHE_DIR=/.cache/uv
7259ENV PYTHONPYCACHEPREFIX=/tmp/blueapi_pycache
7360
0 commit comments