devcontainers (refactored)

this close #1
This commit is contained in:
djmil 2025-09-24 19:52:05 +00:00
parent 28a7c67aa3
commit 47857eeaf7
35 changed files with 47 additions and 53 deletions

View File

@ -11,6 +11,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& mkdir /workspace && mkdir /workspace
# Uncoment to install custom libraries
#RUN git clone --depth 1 --branch 2024.02.14 https://github.com/Microsoft/vcpkg.git /opt/vcpkg \ #RUN git clone --depth 1 --branch 2024.02.14 https://github.com/Microsoft/vcpkg.git /opt/vcpkg \
# && cd /opt/vcpkg \ # && cd /opt/vcpkg \
# && ./bootstrap-vcpkg.sh \ # && ./bootstrap-vcpkg.sh \

10
.devcontainer/README.md Normal file
View File

@ -0,0 +1,10 @@
# Alternatives to Dev Containers
1. Locally install all required dependencies on your host (dev) machine.
If you're actively developing multiple projects in multiple languages, this kind of setup becomes _messy_ very quickly.
2. Manually install IDE of choice into a Docker container and than use [X11 window forwarding](https://goteleport.com/blog/x11-forwarding/) to automagically _spawn_ an IDE window onto your host PC.
I mean... yes, you **can** do this — but why?
3. SSH into Docker while simulatneosly connecting your vim pedal to the nearest free USB port.
Old, but gold 😊

View File

@ -0,0 +1,14 @@
{
"name": "Telemetry Dev Container",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"hbenl.test-adapter-converter",
"matepek.vscode-catch2-test-adapter",
"bierner.markdown-mermaid"
]
}
},
"dockerFile": "Dockerfile"
}

3
.gitignore vendored
View File

@ -45,3 +45,6 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
build/* build/*
# MacOS directory configurations
.DS_Store

View File

@ -70,5 +70,7 @@
"*.inc": "cpp", "*.inc": "cpp",
"csignal": "cpp", "csignal": "cpp",
"shared_mutex": "cpp" "shared_mutex": "cpp"
} },
"cmake.configureOnOpen": true
} }

View File

@ -1,22 +1,25 @@
# Telemetry # Telemetry
A simple yet functional library for capturing runtime analytic events from embedded devices. A simple yet functional library for capturing runtime analytic events from embedded devices.
# Build & run # Build & Run
`Dockerfile` with two helper scripts were added into project's root folder. Buy doing so, two useful goals were achieved: Consult the `.devcontainers/Dockerfile` for the list of project dependencies.
- **Infrastructure as a code**:
All project dependancies and as well as all installation / configuration steps are easily documented as groups of handy scripts inside `Dockerfile`.
- **Containerization**:
Almost instant ability to jump into app development, testing and/or deployment with zero footprint (pollution) on main (host) PC.
## IDE ## VsCode Dev Containers
[VsCode](https://code.visualstudio.com/) IDE was used for in-container development. There is two different ways how one might approach this task: I am in no way a M$ fanboy, but the VsCode IDE seems to be a versatile, Swiss-army-knife tool. Long story short: you are highly advised to use the latest version of VsCode for a quick, hassle-free yet comprehensive overview of the project.
- [Attach](https://code.visualstudio.com/docs/devcontainers/attach-container) VsCode to already [[#Build & run|running]] container
- Manually [install](https://github.com/ahmadnassri/docker-vscode-server/blob/master/Dockerfile) VsCode IDE into container and use [X11 window forwarding](https://goteleport.com/blog/x11-forwarding/), to automagically *spawn* VsCode IDE window on host PC
# Design goals 1. Upon opening the project's folder, VsCode should ask you to reopen the project as a `devcontainer`. Simply agree, and allow all necessary configuration to happen in the background.
> ⚠️ If not prompted ⚠️ <br>
> `Ctrl + Shift + P` > `Dev Containers: Reopen in Container`
2. Use the pre-installed **CMake** extension to configure and build the project.
3. Use **Test Explorer** to run and debug tests.
# Library design goals
- agnostic to payload format - agnostic to payload format
- adequate runtime overhead - adequate runtime overhead

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
docker build -t telemetry-ide:latest .

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
docker run \
--name telemetry \
-v $(pwd)/src:/workspace \
-it telemetry-ide:latest

View File

@ -1,28 +0,0 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++-12 build active file",
"command": "/usr/bin/g++-12",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}