From 8847945734f190e844e866197bf372957b3a85fb Mon Sep 17 00:00:00 2001 From: John Hollowell Date: Fri, 23 Aug 2024 21:25:16 -0400 Subject: [PATCH] Add devcontainer (#4491) devcontainers can be used by IDEs/editors like VS Code to create a standardized development environment in a container --- .devcontainer/Dockerfile | 24 ++++++++++++++++++++++++ .devcontainer/devcontainer.json | 28 ++++++++++++++++++++++++++++ .devcontainer/setup.sh | 3 +++ 3 files changed, 55 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..82f4d91bf --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 + +# [Optional] Uncomment this section to install additional packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + ca-certificates \ + g++ \ + git \ + libbluetooth-dev \ + libgpiod-dev \ + liborcania-dev \ + libssl-dev \ + libulfius-dev \ + libyaml-cpp-dev \ + pkg-config \ + python3 \ + python3-pip \ + python3-venv \ + python3-wheel \ + wget \ + zip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN pip3 install --no-cache-dir -U platformio==6.1.15 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..e45fd5d93 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Meshtastic Firmware Dev", + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/python:1": { + "installTools": true, + "version": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "platformio.platformio-ide", + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ 4403 ], + + // Run commands to prepare the container for use + "postCreateCommand": ".devcontainer/setup.sh", +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 000000000..866a4a417 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +git submodule update --init \ No newline at end of file