From 3585bcb67c0e1fdc6660cf192e1944958163aeee Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Tue, 14 Nov 2023 09:53:41 -0700 Subject: [PATCH 1/5] Install llvm with automatic script. --- .docker/netremote-dev/Dockerfile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.docker/netremote-dev/Dockerfile b/.docker/netremote-dev/Dockerfile index 558af88e..3f67e543 100644 --- a/.docker/netremote-dev/Dockerfile +++ b/.docker/netremote-dev/Dockerfile @@ -4,6 +4,7 @@ FROM ubuntu:mantic as netremote # Set arguments used only in this Dockerfile. ARG build_date="2023-11-09T19:51:18Z" ARG DEBIAN_FRONTEND=noninteractive +ARG LLVM_VERSION=17 LABEL maintainer="Andrew Beltrano (anbeltra@microsoft.com)" LABEL org.label-schema.build-date = "${build_date}" @@ -17,28 +18,36 @@ LABEL org.label-schema.schema-version = "1.0" RUN apt-get update && \ apt-get install -qq -y --no-install-recommends \ # Project build dependencies. - # build-essential ca-certificates clang-17 cmake curl dotnet7 git gnupg linux-libc-dev lldb llvm ninja-build pkg-config tar unzip zip + # build-essential ca-certificates cmake curl dotnet7 git gnupg linux-libc-dev lsb-release ninja-build pkg-config software-properties-common tar unzip wget zip build-essential \ ca-certificates \ - clang-17 \ cmake \ curl \ dotnet7 \ git \ gnupg \ linux-libc-dev \ - lldb \ - llvm \ + lsb-release \ ninja-build \ pkg-config \ + software-properties-common \ tar \ unzip \ + wget \ zip \ && \ + # Remove llvm 16 toolchain packages to avoid conflicts with llvm 17 toolchain. + apt-get remove -y --purge clang-16* lldb-16* llvm-16* && \ # Reduce image size by removing package cache apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Install complete llvm toolchain using automatic installation script. +RUN wget https://apt.llvm.org/llvm.sh && \ + chmod +x llvm.sh && \ + ./llvm.sh ${LLVM_VERSION} all && \ + rm llvm.sh + FROM netremote as netremote-dev # Install packages. @@ -55,7 +64,6 @@ RUN apt-get update && \ rsync \ ssh \ sudo \ - wget \ # Generic development tools. # clang-format clang-tidy emacs gdb nano policycoreutils-python-utils python-is-python3 vim clang-format \ From d05e210a1c31efe4a724752bae414ee9e66e2547 Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Tue, 14 Nov 2023 09:56:56 -0700 Subject: [PATCH 2/5] Use compose extension. --- .devcontainer/compose-devcontainer.yaml | 9 --------- .docker/compose.yaml | 10 ++++++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.devcontainer/compose-devcontainer.yaml b/.devcontainer/compose-devcontainer.yaml index eefc4933..fcb1c84f 100644 --- a/.devcontainer/compose-devcontainer.yaml +++ b/.devcontainer/compose-devcontainer.yaml @@ -7,16 +7,7 @@ services: # extended, which is in .docker/netremote-dev, hence, the workspace root is # 1 levels up (eg. ../). - ../:/netremote:cached - # Enable debugging for ptrace-based debuggers (C++, Go, Rust). - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined netremote-dev-hostapd: volumes: - ../:/netremote:cached - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined diff --git a/.docker/compose.yaml b/.docker/compose.yaml index 64db3078..6d3dcbe8 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -7,11 +7,13 @@ services: tty: true stdin_open: true privileged: true + # Enable debugging for ptrace-based debuggers (C++, Go, Rust). + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined netremote-dev-hostapd: + extends: netremote-dev build: - context: netremote-dev target: netremote-dev-hostapd - tty: true - stdin_open: true - privileged: true From 677644c346109128cce4fd590e456d82c7454cbc Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Tue, 14 Nov 2023 10:31:59 -0700 Subject: [PATCH 3/5] Add persistent volume for source. --- .devcontainer/compose-devcontainer.yaml | 11 +++++------ .devcontainer/devcontainer.json | 5 ++--- .docker/compose.yaml | 5 +++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.devcontainer/compose-devcontainer.yaml b/.devcontainer/compose-devcontainer.yaml index fcb1c84f..61ac06a9 100644 --- a/.devcontainer/compose-devcontainer.yaml +++ b/.devcontainer/compose-devcontainer.yaml @@ -2,12 +2,11 @@ services: netremote-dev: volumes: - # Mounts the project folder to '/netremote'. - # The source directory is relative to the the compose.yaml file being - # extended, which is in .docker/netremote-dev, hence, the workspace root is - # 1 levels up (eg. ../). - - ../:/netremote:cached + - source:/workspace netremote-dev-hostapd: volumes: - - ../:/netremote:cached + - source:/workspace + +volumes: + source: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 39a4dceb..d48c8d4d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,11 +3,10 @@ { "name": "NetRemote Development Environment", "dockerComposeFile": [ - "../.docker/compose.yaml", - "./compose-devcontainer.yaml" + "../.docker/compose.yaml" ], "service": "netremote-dev-hostapd", - "workspaceFolder": "/netremote", + "workspaceFolder": "/workspace", "shutdownAction": "none", "customizations": { "vscode": { diff --git a/.docker/compose.yaml b/.docker/compose.yaml index 6d3dcbe8..85efcc80 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -12,8 +12,13 @@ services: - SYS_PTRACE security_opt: - seccomp:unconfined + volumes: + - source:/workspace netremote-dev-hostapd: extends: netremote-dev build: target: netremote-dev-hostapd + +volumes: + source: From 73eded69932c46d749b652657d3aabf0553290e8 Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Tue, 14 Nov 2023 11:34:54 -0700 Subject: [PATCH 4/5] Isolate volumes into devcontainer. --- .devcontainer/compose-devcontainer.yaml | 8 +++++--- .devcontainer/devcontainer.json | 5 +++-- .docker/compose.yaml | 5 ----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.devcontainer/compose-devcontainer.yaml b/.devcontainer/compose-devcontainer.yaml index 61ac06a9..81348e37 100644 --- a/.devcontainer/compose-devcontainer.yaml +++ b/.devcontainer/compose-devcontainer.yaml @@ -2,11 +2,13 @@ services: netremote-dev: volumes: - - source:/workspace + - ../..:/workspaces:cached + - workspace:/workspace netremote-dev-hostapd: volumes: - - source:/workspace + - ../..:/workspaces:cached + - workspace:/workspace volumes: - source: + workspace: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d48c8d4d..8ed6fcf7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,10 +3,11 @@ { "name": "NetRemote Development Environment", "dockerComposeFile": [ - "../.docker/compose.yaml" + "../.docker/compose.yaml", + "./compose-devcontainer.yaml" ], "service": "netremote-dev-hostapd", - "workspaceFolder": "/workspace", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "shutdownAction": "none", "customizations": { "vscode": { diff --git a/.docker/compose.yaml b/.docker/compose.yaml index 85efcc80..6d3dcbe8 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -12,13 +12,8 @@ services: - SYS_PTRACE security_opt: - seccomp:unconfined - volumes: - - source:/workspace netremote-dev-hostapd: extends: netremote-dev build: target: netremote-dev-hostapd - -volumes: - source: From fd282a4c61f3f7e834493f5766c78c79709b740f Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Tue, 14 Nov 2023 11:36:38 -0700 Subject: [PATCH 5/5] Fix spacing. --- .devcontainer/devcontainer.json | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8ed6fcf7..9f09b66e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,26 +1,26 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose { - "name": "NetRemote Development Environment", - "dockerComposeFile": [ - "../.docker/compose.yaml", - "./compose-devcontainer.yaml" - ], - "service": "netremote-dev-hostapd", - "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", - "shutdownAction": "none", - "customizations": { - "vscode": { - "extensions": [ - "cschlosser.doxdocgen", - "eamodio.gitlens", - "EditorConfig.EditorConfig", - "GitHub.copilot-chat", - "GitHub.copilot", - "ms-vscode.cmake-tools", - "ms-vscode.cpptools", - "ms-vscode.makefile-tools" - ] - } - } + "name": "NetRemote Development Environment", + "dockerComposeFile": [ + "../.docker/compose.yaml", + "./compose-devcontainer.yaml" + ], + "service": "netremote-dev-hostapd", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "shutdownAction": "none", + "customizations": { + "vscode": { + "extensions": [ + "cschlosser.doxdocgen", + "eamodio.gitlens", + "EditorConfig.EditorConfig", + "GitHub.copilot-chat", + "GitHub.copilot", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.makefile-tools" + ] + } + } } \ No newline at end of file