first commit.
This commit is contained in:
66
.devcontainer/Dockerfile
Normal file
66
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,66 @@
|
||||
ARG VARIANT=bookworm-slim
|
||||
FROM debian:${VARIANT}
|
||||
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 ESP_BOARD=all
|
||||
ARG GITHUB_TOKEN
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y pkg-config curl gcc clang libudev-dev unzip xz-utils \
|
||||
git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 \
|
||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
|
||||
|
||||
# Set users
|
||||
RUN adduser --disabled-password --gecos "" ${CONTAINER_USER}
|
||||
USER ${CONTAINER_USER}
|
||||
WORKDIR /home/${CONTAINER_USER}
|
||||
|
||||
# Install rustup
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
|
||||
--default-toolchain none -y --profile minimal
|
||||
|
||||
# Update envs
|
||||
ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin
|
||||
|
||||
# Install extra crates
|
||||
RUN ARCH=$($HOME/.cargo/bin/rustup show | grep "Default host" | sed -e 's/.* //') && \
|
||||
curl -L "https://github.com/esp-rs/espup/releases/latest/download/espup-${ARCH}" -o "${HOME}/.cargo/bin/espup" && \
|
||||
chmod u+x "${HOME}/.cargo/bin/espup" && \
|
||||
curl -L "https://github.com/esp-rs/espflash/releases/latest/download/cargo-espflash-${ARCH}.zip" -o "${HOME}/.cargo/bin/cargo-espflash.zip" && \
|
||||
unzip "${HOME}/.cargo/bin/cargo-espflash.zip" -d "${HOME}/.cargo/bin/" && \
|
||||
rm "${HOME}/.cargo/bin/cargo-espflash.zip" && \
|
||||
chmod u+x "${HOME}/.cargo/bin/cargo-espflash" && \
|
||||
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" && \
|
||||
curl -L "https://github.com/esp-rs/embuild/releases/latest/download/ldproxy-${ARCH}.zip" -o "${HOME}/.cargo/bin/ldproxy.zip" && \
|
||||
unzip "${HOME}/.cargo/bin/ldproxy.zip" -d "${HOME}/.cargo/bin/" && \
|
||||
rm "${HOME}/.cargo/bin/ldproxy.zip" && \
|
||||
chmod u+x "${HOME}/.cargo/bin/ldproxy" && \
|
||||
curl -L "https://github.com/esp-rs/esp-web-flash-server/releases/latest/download/web-flash-${ARCH}.zip" -o "${HOME}/.cargo/bin/web-flash.zip" && \
|
||||
unzip "${HOME}/.cargo/bin/web-flash.zip" -d "${HOME}/.cargo/bin/" && \
|
||||
rm "${HOME}/.cargo/bin/web-flash.zip" && \
|
||||
chmod u+x "${HOME}/.cargo/bin/web-flash"
|
||||
|
||||
# Install Xtensa Rust
|
||||
RUN if [ -n "${GITHUB_TOKEN}" ]; then export GITHUB_TOKEN=${GITHUB_TOKEN}; fi \
|
||||
&& ${HOME}/.cargo/bin/espup install\
|
||||
--targets "${ESP_BOARD}" \
|
||||
--log-level debug \
|
||||
--export-file /home/${CONTAINER_USER}/export-esp.sh
|
||||
|
||||
# Set default toolchain
|
||||
RUN rustup default nightly
|
||||
|
||||
|
||||
# Activate ESP environment
|
||||
RUN echo "source /home/${CONTAINER_USER}/export-esp.sh" >> ~/.bashrc
|
||||
|
||||
CMD [ "/bin/bash" ]
|
44
.devcontainer/devcontainer.json
Normal file
44
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "network_monitor_esp_rs",
|
||||
// Select between image and build propieties to pull or build the image.
|
||||
// "image": "docker.io/espressif/idf-rust:esp32c3_latest",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"CONTAINER_USER": "esp",
|
||||
"CONTAINER_GROUP": "esp",
|
||||
"ESP_BOARD": "esp32c3"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "file",
|
||||
"editor.formatOnType": true,
|
||||
"lldb.executable": "/usr/bin/lldb",
|
||||
"files.watcherExclude": {
|
||||
"**/target/**": true
|
||||
},
|
||||
"rust-analyzer.checkOnSave.command": "clippy",
|
||||
"rust-analyzer.checkOnSave.allTargets": false,
|
||||
"[rust]": {
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"rust-lang.rust-analyzer",
|
||||
"tamasfe.even-better-toml",
|
||||
"serayuzgur.crates",
|
||||
"mutantdino.resourcemonitor",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"ms-vscode.cpptools",
|
||||
"actboy168.tasks",
|
||||
"Wokwi.wokwi-vscode"
|
||||
],
|
||||
"forwardPorts": [
|
||||
3333,
|
||||
8000
|
||||
],
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/esp/network_monitor_esp_rs,type=bind,consistency=cached",
|
||||
"workspaceFolder": "/home/esp/network_monitor_esp_rs"
|
||||
}
|
Reference in New Issue
Block a user