Skip to content

Commit a72535c

Browse files
committed
Fix devcontainer to work with noble
1 parent 7b69902 commit a72535c

File tree

2 files changed

+50
-48
lines changed

2 files changed

+50
-48
lines changed

.devcontainer/Dockerfile

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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
3939
RUN 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
7071
ENV PATH "/root/.cargo/bin:$PATH"
7172

7273
# clang by default
7374
ENV CC=clang-20
7475
ENV 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
8078
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
8179
&& locale-gen

.devcontainer/devcontainer.json

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
2-
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/ubuntu-18.04-git
2+
// https://github.com/devcontainers/images/blob/main/README.md
33
{
4-
"name": "Ubuntu 20.04 & Git",
4+
"name": "Ubuntu 24.04 & Git",
55
"dockerFile": "Dockerfile",
66
"build": {
77
"args": {
@@ -12,35 +12,39 @@
1212
// The optional 'runArgs' property can be used to specify additional runtime arguments.
1313
"runArgs": [
1414
// Uncomment the line if you will use a ptrace-based debugger like C++, Go, and Rust.
15-
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined",
16-
15+
"--cap-add=SYS_PTRACE",
16+
"--security-opt",
17+
"seccomp=unconfined",
1718
// Uncomment the next line to use a non-root user. On Linux, this will prevent
1819
// new files getting created as root, but you may need to update the USER_UID
1920
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
20-
"-u", "vscode"
21+
"-u",
22+
"vscode"
2123
],
2224

23-
// Use 'settings' to set *default* container specific settings.json values on container create.
24-
// You can edit these settings after create using File > Preferences > Settings > Remote.
25-
"settings": {
26-
"terminal.integrated.shell.linux": "/bin/bash"
27-
},
28-
29-
// Use 'features.docker-from-docker' to setup docker inside the container
30-
// for building the Docker images inside GitHub Codespaces.
31-
"features": {
32-
"docker-from-docker": {
33-
"version": "latest",
34-
"moby": true
35-
}
36-
},
25+
// We previously had `features.docker-from-docker` enabled here to allow
26+
// running docker commands inside the container. However we now disable that
27+
// as we are are using the devcontainers as a moderate-strength security
28+
// boundary to sandbox the copilot LLMs. We don't want them running host
29+
// docker commands -- that would violate the whole point of the sandbox.
3730

3831
// Uncomment the next line if you want to publish any ports.
3932
// "appPort": [],
40-
4133
// Uncomment the next line to run commands after the container is created.
4234
// "postCreateCommand": "uname -a",
43-
44-
// Add the IDs of extensions you want installed when the container is created in the array below.
45-
"extensions": []
46-
}
35+
"customizations": {
36+
"vscode": {
37+
"settings": {
38+
"terminal.integrated.shell.linux": "/bin/bash",
39+
"clangd.path": "/usr/bin/clangd-20"
40+
},
41+
"extensions": [
42+
"llvm-vs-code-extensions.vscode-clangd",
43+
"llvm-vs-code-extensions.lldb-dap",
44+
"matepek.vscode-catch2-test-adapter",
45+
"rust-lang.rust-analyzer",
46+
"graydon.lsp-lm-tool"
47+
]
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)