Initial commit

Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
This commit is contained in:
Thomas Klaehn
2026-03-12 13:49:07 +01:00
commit 2301274850
17 changed files with 1834 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
# Base image
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Arguments
ARG CONTAINER_USER=esp
ARG CONTAINER_GROUP=esp
ARG NIGHTLY_VERSION=nightly-2025-11-01
# Install dependencies
RUN apt-get update \
&& apt-get install -y \
curl unzip git pkg-config gcc \
libssl-dev libusb-1.0-0 libusb-1.0-0-dev libudev-dev \
sudo \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN adduser --disabled-password --gecos "" ${CONTAINER_USER}
# Allow esp to sync the dialout group GID at container start
RUN echo "${CONTAINER_USER} ALL=(root) NOPASSWD: /usr/sbin/groupadd, /usr/sbin/groupmod, /usr/sbin/usermod, /usr/bin/chmod" \
>> /etc/sudoers.d/esp-dialout
USER ${CONTAINER_USER}
WORKDIR /home/${CONTAINER_USER}
# Install rustup + nightly toolchain with RISC-V target and rust-src component
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
--default-toolchain ${NIGHTLY_VERSION} -y --profile minimal \
--component rust-src,clippy,rustfmt \
--target riscv32imac-unknown-none-elf
ENV PATH=${PATH}:$HOME/.cargo/bin
# Install espflash (flash + monitor tool)
RUN ARCH=$($HOME/.cargo/bin/rustup show | grep "Default host" | sed -e 's/.* //') && \
curl -L "https://github.com/esp-rs/espflash/releases/latest/download/espflash-${ARCH}.zip" \
-o "${HOME}/.cargo/bin/espflash.zip" && \
unzip "${HOME}/.cargo/bin/espflash.zip" -d "${HOME}/.cargo/bin/" && \
rm "${HOME}/.cargo/bin/espflash.zip" && \
chmod u+x "${HOME}/.cargo/bin/espflash"
# Install probe-rs (on-chip debugger, flashing, RTT)
RUN $HOME/.cargo/bin/cargo install probe-rs-tools --locked
CMD ["/bin/bash"]
+45
View File
@@ -0,0 +1,45 @@
{
"name": "esp32c6-dev",
"build": {
"dockerfile": "Dockerfile",
"args": {
"NIGHTLY_VERSION": "nightly-2025-11-01"
}
},
// Privileged container to access /dev
"privileged": true,
// Mount USB bus so espflash can reach the connected board
"mounts": [
"source=/dev/bus/usb/,target=/dev/bus/usb/,type=bind"
],
"runArgs": [
"--device=/dev/ttyACM0",
"--device=/dev/ttyACM1"
],
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.check.command": "clippy",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
},
"extensions": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"mutantdino.resourcemonitor",
"probe-rs.probe-rs-debugger"
]
}
},
"postCreateCommand": "DIALOUT_GID=$(stat -c '%g' /dev/ttyACM0 2>/dev/null || stat -c '%g' /dev/ttyACM1 2>/dev/null || echo 20) && (getent group dialout > /dev/null && sudo groupmod -g $DIALOUT_GID dialout || sudo groupadd -g $DIALOUT_GID dialout) && sudo usermod -aG dialout esp && USB_GID=$(stat -c '%g' /dev/bus/usb/*/* 2>/dev/null | sort -u | head -1 || echo 46) && (getent group plugdev > /dev/null && sudo groupmod -g $USB_GID plugdev || sudo groupadd -g $USB_GID plugdev) && sudo usermod -aG plugdev esp || true",
"postStartCommand": "sudo chmod a+rw /dev/bus/usb/*/* 2>/dev/null; sudo chmod a+rw /dev/ttyACM* 2>/dev/null; true",
"remoteUser": "esp",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"workspaceFolder": "/workspace"
}