Skip to content

Commit 8597933

Browse files
committed
fix: Enhance the dev container setup to include additional extentions and support for the ESP platform
1 parent e9d555f commit 8597933

3 files changed

Lines changed: 41 additions & 14 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
77
python3-pip \
88
git \
99
curl \
10+
fish \
1011
&& apt-get clean \
1112
&& rm -rf /var/lib/apt/lists/*
1213

14+
RUN mkdir -p /home/vscode/.local/share/CMakeTools \
15+
&& chown -R vscode:vscode /home/vscode/.local/share/CMakeTools
16+
1317
# Install arduino-cli
1418
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
1519

@@ -22,16 +26,16 @@ ENV PATH="/usr/local/bin:${PATH}"
2226
# Create workspace directory
2327
WORKDIR /workspace
2428

25-
# Copy arduino-cli configuration
29+
# Copy arduino-cli configuration (customize to your actual path)
2630
COPY arduino-cli.yaml /root/.arduino15/arduino-cli.yaml
2731

2832
# Install build essentials
29-
RUN apt-get update && apt-get install -y build-essential
33+
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
3034

31-
# Install Arduino cores for ESP8266 and ESP32
35+
# (Optional) Install Arduino cores for ESP8266 and ESP32 if needed
3236
RUN arduino-cli core install esp8266:esp8266 esp32:esp32
3337

34-
# Install only required dependencies for DallasTemperature library
38+
# Install only required dependencies for DallasTemperature library and others
3539
RUN arduino-cli lib install \
3640
"OneWire" \
3741
"ArduinoUnit" # For testing
@@ -43,13 +47,24 @@ RUN arduino-cli lib list
4347
COPY update-libraries.sh /usr/local/bin/
4448
RUN chmod +x /usr/local/bin/update-libraries.sh
4549

46-
# Add aliases for build operations
50+
# Add aliases for build operations (for Bash)
4751
RUN echo 'alias arduino-build="./build.sh build"' >> /home/vscode/.bashrc && \
4852
echo 'alias arduino-test="./build.sh test"' >> /home/vscode/.bashrc && \
4953
echo 'alias arduino-build-test="./build.sh all"' >> /home/vscode/.bashrc
5054

51-
# Add welcome message to .bashrc
55+
# Add a welcome message to .bashrc
5256
RUN echo '\n# Welcome to the dev container! Here are some useful aliases:' >> /home/vscode/.bashrc && \
5357
echo 'echo " - arduino-build: Build the project"' >> /home/vscode/.bashrc && \
5458
echo 'echo " - arduino-test: Run tests for the project"' >> /home/vscode/.bashrc && \
5559
echo 'echo " - arduino-build-test: Build and test the project"' >> /home/vscode/.bashrc
60+
61+
# (Optional) Add fish-specific configuration if desired
62+
# For example, you might add an alias file or welcome message for fish:
63+
RUN mkdir -p /home/vscode/.config/fish && \
64+
echo 'set -gx PATH /usr/local/bin $PATH' >> /home/vscode/.config/fish/config.fish && \
65+
echo '# Welcome to the Fish shell inside the dev container!' >> /home/vscode/.config/fish/config.fish
66+
67+
# If you want to default to fish shell (uncomment below),
68+
# you can either set the SHELL environment variable or change the user default shell:
69+
# RUN chsh -s /usr/bin/fish vscode
70+
# ENV SHELL=/usr/bin/fish

.devcontainer/arduino-cli.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ compile:
1212
unittest:
1313
# These dependent libraries will be installed
1414
libraries:
15-
- "OneWire"
15+
- "OneWire"
16+
board_manager:
17+
additional_urls:
18+
- https://arduino.esp8266.com/stable/package_esp8266com_index.json
19+
- https://dl.espressif.com/dl/package_esp32_index.json

.devcontainer/devcontainer.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"name": "Arduino Library Development",
33
"dockerFile": "Dockerfile",
4+
"mounts": [
5+
"source=devcontainer_ssh,target=/home/vscode/.ssh,type=volume",
6+
"source=devcontainer_bash_history,target=/home/vscode/.bash_history,type=volume",
7+
"source=devcontainer_fish_history,target=/home/vscode/.local/share/fish/fish_history,type=volume"
8+
],
49
"customizations": {
5-
"vscode": {
6-
"extensions": [
7-
"vsciot-vscode.vscode-arduino",
8-
"ms-vscode.cpptools"
9-
]
10-
}
10+
"vscode": {
11+
"extensions": [
12+
"vsciot-vscode.vscode-arduino",
13+
"ms-vscode.cpptools",
14+
"ms-azuretools.vscode-docker",
15+
"yzhang.markdown-all-in-one"
16+
]
17+
}
1118
},
1219
"postCreateCommand": "arduino-cli core install arduino:avr && arduino-cli lib install ArduinoUnit && /usr/local/bin/update-libraries.sh",
1320
"updateContentCommand": "/usr/local/bin/update-libraries.sh",
1421
"remoteUser": "vscode"
15-
}
22+
}
23+

0 commit comments

Comments
 (0)