Skip to content

Commit 873c59e

Browse files
committed
Fix devcontainer to work with noble
1 parent 34efe40 commit 873c59e

File tree

2 files changed

+54
-48
lines changed

2 files changed

+54
-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 libc++abi-20-dev libclang-rt-20-dev \
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: 32 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": {
@@ -11,36 +11,44 @@
1111
"onCreateCommand": "./install-rust.sh",
1212
// The optional 'runArgs' property can be used to specify additional runtime arguments.
1313
"runArgs": [
14-
// 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",
14+
// Uncomment these lines if you will use a ptrace-based debugger like C++, Go, and Rust.
15+
// Note that these options have security implications and should be used with caution.
16+
// We have them disabled currently because we don't want to allow copilot LLMs to use ptrace
17+
// to escape the container sandbox.
18+
// "--cap-add=SYS_PTRACE",
19+
// "--security-opt",
20+
// "seccomp=unconfined",
1621

1722
// Uncomment the next line to use a non-root user. On Linux, this will prevent
1823
// new files getting created as root, but you may need to update the USER_UID
1924
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
20-
"-u", "vscode"
25+
"-u",
26+
"vscode"
2127
],
2228

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-
},
29+
// We previously had `features.docker-from-docker` enabled here to allow
30+
// running docker commands inside the container. However we now disable that
31+
// as we are are using the devcontainers as a moderate-strength security
32+
// boundary to sandbox the copilot LLMs. We don't want them running host
33+
// docker commands -- that would violate the whole point of the sandbox.
3734

3835
// Uncomment the next line if you want to publish any ports.
3936
// "appPort": [],
40-
4137
// Uncomment the next line to run commands after the container is created.
4238
// "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-
}
39+
"customizations": {
40+
"vscode": {
41+
"settings": {
42+
"terminal.integrated.defaultProfile.linux": "bash",
43+
"clangd.path": "/usr/bin/clangd-20"
44+
},
45+
"extensions": [
46+
"llvm-vs-code-extensions.vscode-clangd",
47+
"llvm-vs-code-extensions.lldb-dap",
48+
"matepek.vscode-catch2-test-adapter",
49+
"rust-lang.rust-analyzer",
50+
"graydon.lsp-lm-tool"
51+
]
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)