@@ -31,51 +31,49 @@ RUN if [ ! -z "${APT_MIRROR}" ]; then \
3131 sed -i \
3232 -e "s|http://archive.ubuntu.com/ubuntu/|${APT_MIRROR}|" \
3333 -e "s|http://security.ubuntu.com/ubuntu/|${APT_MIRROR}|" \
34- /etc/apt/sources.list \
34+ /etc/apt/sources.list.d/ubuntu.sources \
3535 ; fi \
36- ; grep "^[^#;]" /etc/apt/sources.list
36+ ; grep "^[^#;]" /etc/apt/sources.list.d/ubuntu.sources
3737
3838# install base container packages and prep for VSCode
3939RUN apt-get update \
4040 # Verify process tools, lsb-release (common in install instructions for CLIs) installed
4141 && apt-get -y install iproute2 procps lsb-release \
4242 #
4343 # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
44- && groupadd --gid $USER_GID $USERNAME \
45- && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
44+ # If group/user with the specified GID/UID already exists, rename them to $USERNAME.
45+ && if getent group $USER_GID > /dev/null 2>&1; then \
46+ groupmod -n $USERNAME $(getent group $USER_GID | cut -d: -f1); \
47+ else \
48+ groupadd --gid $USER_GID $USERNAME; \
49+ fi \
50+ && if id -u $USER_UID > /dev/null 2>&1; then \
51+ existing_user=$(getent passwd $USER_UID | cut -d: -f1); \
52+ usermod -l $USERNAME -d /home/$USERNAME -m -s /bin/bash $existing_user; \
53+ else \
54+ useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME; \
55+ fi \
4656 # [Optional] Add sudo support for the non-root user
4757 && apt-get install -y sudo \
4858 && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
4959 && chmod 0440 /etc/sudoers.d/$USERNAME
5060
51- # Add test tool chain
52- # NOTE: newer version of the compilers are not
53- # provided by stock distributions
54- # and are provided by the /test toolchain
55- # RUN apt-get -y install software-properties-common \
56- # && add-apt-repository ppa:ubuntu-toolchain-r/test \
57- # && apt-get update
61+ # Install build and dev requirements
62+ RUN apt-get update && \
63+ apt-get -y install \
64+ git build-essential pkg-config autoconf automake libtool bison flex sed perl \
65+ libpq-dev parallel curl ccache bear \
66+ cpp-14 gcc-14 g++-14 libstdc++-14-dev \
67+ clang-20 llvm-20 libc++-20-dev clang-format-20 clangd-20 \
68+ postgresql
5869
59- # Install common compilation tools
60- RUN apt-get -y install git build-essential pkg-config autoconf automake libtool bison flex sed perl libpq-dev parallel curl
61-
62- # Update compiler tools
63- RUN apt-get -y install libstdc++-14-dev clang-format-20 ccache
64-
65- # gcc
66- RUN apt-get -y install cpp-14 gcc-14 g++-14
67- # clang
68- RUN apt-get -y install clang-20 llvm-20
6970# rust
7071ENV PATH "/root/.cargo/bin:$PATH"
7172
7273# clang by default
7374ENV CC=clang-20
7475ENV CXX=clang++-20
7576
76- # Install postgresql to enable tests under make check
77- RUN apt-get -y install postgresql
78-
7977# Set up locale
8078RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
8179 && locale-gen
0 commit comments