Skip to content

Commit

Permalink
Merge pull request #15 from microsoft/containerimprovements
Browse files Browse the repository at this point in the history
Dev Container improvements
  • Loading branch information
abeltrano authored Nov 14, 2023
2 parents fc3ca33 + fd282a4 commit 2726a3c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 44 deletions.
22 changes: 7 additions & 15 deletions .devcontainer/compose-devcontainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
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
# Enable debugging for ptrace-based debuggers (C++, Go, Rust).
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
- ../..:/workspaces:cached
- workspace:/workspace

netremote-dev-hostapd:
volumes:
- ../:/netremote:cached
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
- ../..:/workspaces:cached
- workspace:/workspace

volumes:
workspace:
40 changes: 20 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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": [
"name": "NetRemote Development Environment",
"dockerComposeFile": [
"../.docker/compose.yaml",
"./compose-devcontainer.yaml"
],
"service": "netremote-dev-hostapd",
"workspaceFolder": "/netremote",
"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"
]
}
}
],
"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"
]
}
}
}
10 changes: 6 additions & 4 deletions .docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 13 additions & 5 deletions .docker/netremote-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected])"
LABEL org.label-schema.build-date = "${build_date}"
Expand All @@ -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.
Expand All @@ -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 \
Expand Down

0 comments on commit 2726a3c

Please sign in to comment.