@@ -21,18 +21,38 @@ ENV PATH=/venv/bin:$PATH
2121
2222# The build stage installs the context into the venv
2323FROM developer AS build
24- COPY . /context
25- WORKDIR /context
24+ RUN mkdir -p /.cache/pip; chmod o+wrX /.cache/pip
25+ COPY --chmod=o+wrX . /workspaces/blueapi
26+ WORKDIR /workspaces/blueapi
2627RUN touch dev-requirements.txt && pip install --upgrade pip && pip install -c dev-requirements.txt .
2728
29+ FROM build AS debug
30+
31+ # Set origin to use ssh
32+ RUN git remote set-url origin
[email protected] :diamondlightsource/DiamondLightSource/blueapi.git
33+
34+ # For this pod to understand finding user information from LDAP
35+ RUN apt update
36+ RUN DEBIAN_FRONTEND=noninteractive apt install libnss-ldapd -y
37+ RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
38+
39+ # Make editable and debuggable
40+ RUN pip install debugpy
41+ RUN pip install -e .
42+
43+ # Alternate entrypoint to allow devcontainer to attach
44+ ENTRYPOINT [ "/bin/bash" , "-c" , "--" ]
45+ CMD [ "while true; do sleep 30; done;" ]
46+
2847# The runtime stage copies the built venv into a slim runtime container
2948FROM python:${PYTHON_VERSION%@*}-slim AS runtime
3049# Add apt-get system dependecies for runtime here if needed
3150RUN apt-get update && apt-get install -y --no-install-recommends \
3251 # Git required for installing packages at runtime
3352 git \
3453 && rm -rf /var/lib/apt/lists/*
35- COPY --from=build /venv/ /venv/
54+ COPY --from=build --chmod=o+wrX /venv/ /venv/
55+ COPY --from=build --chmod=o+wrX /.cache/pip /.cache/pip
3656ENV PATH=/venv/bin:$PATH
3757ENV PYTHONPYCACHEPREFIX=/tmp/blueapi_pycache
3858
@@ -43,7 +63,5 @@ ENV PYTHONPYCACHEPREFIX=/tmp/blueapi_pycache
4363
4464ENV MPLCONFIGDIR=/tmp/matplotlib
4565
46- RUN mkdir -p /.cache/pip; chmod -R 777 /venv /.cache/pip
47-
4866ENTRYPOINT ["blueapi" ]
4967CMD ["serve" ]
0 commit comments