@@ -102,7 +102,7 @@ RUN --mount=type=cache,target=/cache,sharing=locked \
102102 && apt-get clean
103103
104104# Update all tool alternatives to the correct version
105- # and patch root's bashrc to include bash-completion
105+ # and rename the default 'ubuntu' user to 'code'
106106RUN --mount=type=cache,target=/var/log,sharing=locked \
107107 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10 \
108108 --slave /usr/bin/g++ g++ /usr/bin/g++-14 \
@@ -114,34 +114,15 @@ RUN --mount=type=cache,target=/var/log,sharing=locked \
114114 --slave /usr/bin/mull-reporter mull-reporter /usr/bin/mull-reporter-${CLANG_VERSION} \
115115 --slave /usr/lib/mull-ir-frontend mull-ir-frontend /usr/lib/mull-ir-frontend-${CLANG_VERSION} \
116116 && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
117- && cp /etc/skel/.bashrc /root/.bashrc
117+ && usermod -m -d /home/code -l code ubuntu \
118+ && groupmod -n code ubuntu
118119
119- # Create the 'code' user
120- # First remove the existing ubuntu user and group that use UID/GID 1000
121- RUN userdel -r ubuntu 2>/dev/null || true \
122- && groupdel ubuntu 2>/dev/null || true \
123- && groupadd --gid 1000 code \
124- && useradd --uid 1000 --gid code --shell /bin/bash --create-home code \
125- && cp /etc/skel/.bashrc /home/code/.bashrc \
126- && chown -R code:code /home/code
120+ USER code
127121
128122# Set up package managers CPM and Conan
129123# - Install CPM.cmake to the CMake module path
130124# - Configure a default profile for Conan and set the CMake generator to Ninja
131125RUN --mount=type=cache,target=/cache,sharing=locked \
132- wget --no-hsts -qP /usr/local/lib/python*/dist-packages/cmake/data/share/cmake-*/Modules/ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_VERSION}/CPM.cmake \
126+ wget --no-hsts -qP /usr/local/lib/python*/dist-packages/cmake/data/share/cmake-*/Modules/ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_VERSION}/CPM.cmake
133127 && conan profile detect \
134128 && echo -e "\n [conf]\n tools.cmake.cmaketoolchain:generator=Ninja" >> "$(conan profile path default)"
135-
136- # Create cache directories and conan directory with appropriate permissions for the code user
137- RUN mkdir -p /cache/.ccache /cache/.cpm /cache/.python /opt/conan \
138- && chown -R code:code /cache /opt/conan \
139- && chmod -R 755 /cache /opt/conan
140-
141- # Set up conan for the code user
142- USER code
143- RUN conan profile detect \
144- && echo -e "\n [conf]\n tools.cmake.cmaketoolchain:generator=Ninja" >> "$(conan profile path default)"
145-
146- # Set the default user
147- USER code
0 commit comments