11# The devcontainer should use the developer target and run as root with podman
22# or docker with user namespaces.
33ARG PYTHON_VERSION=3.11
4+
5+ # The developer is used by devcontainers ###############################################
46FROM python:${PYTHON_VERSION} AS developer
57
68# Add any system dependencies for the developer/build environment here
@@ -15,13 +17,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1517RUN python -m venv /venv
1618ENV PATH=/venv/bin:$PATH
1719
18- # The build stage installs the context into the venv
20+ # The build stage installs the context into the venv ###################################
1921FROM developer AS build
22+
2023# Requires buildkit 0.17.0
2124COPY --chmod=o+wrX . /workspaces/fastcs-example
2225WORKDIR /workspaces/fastcs-example
2326RUN touch dev-requirements.txt && pip install debugpy -c dev-requirements.txt .[demo]
2427
28+ # The debug stage allows for debugging and development #################################
2529FROM build AS debug
2630
2731# Set origin to use ssh
@@ -45,15 +49,14 @@ RUN sed -i 's/files/ldap files/g' /etc/nsswitch.conf
4549# Alternate entrypoint to allow restarting the IOC
4650ENTRYPOINT [ "/bin/bash" , "-c" , "sleep infinity" ]
4751
48- # The runtime stage copies the built venv into a slim runtime container
52+ # The runtime stage has built venv only ################################################
4953FROM python:${PYTHON_VERSION}-slim AS runtime
5054
5155# Add apt-get system dependecies for runtime
5256RUN apt-get update && apt-get install -y --no-install-recommends \
5357 gdb \
5458 && rm -rf /var/lib/apt/lists/*
5559
56-
5760COPY --from=build /venv/ /venv/
5861ENV PATH=/venv/bin:$PATH
5962
0 commit comments