Skip to content

Commit 140d78d

Browse files
authored
Merge pull request #270 from milesburton/fix/improve-devcontainer
Fix/improve devcontainer generation
2 parents e9d555f + a28a250 commit 140d78d

File tree

6 files changed

+51
-17
lines changed

6 files changed

+51
-17
lines changed

.devcontainer/Dockerfile

+28-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ 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+
17+
RUN mkdir -p /home/vscode/.ssh \
18+
&& chown vscode:vscode /home/vscode/.ssh \
19+
&& chmod 700 /home/vscode/.ssh
20+
1321
# Install arduino-cli
1422
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
1523

@@ -22,16 +30,16 @@ ENV PATH="/usr/local/bin:${PATH}"
2230
# Create workspace directory
2331
WORKDIR /workspace
2432

25-
# Copy arduino-cli configuration
33+
# Copy arduino-cli configuration (customise to your actual path)
2634
COPY arduino-cli.yaml /root/.arduino15/arduino-cli.yaml
2735

2836
# Install build essentials
29-
RUN apt-get update && apt-get install -y build-essential
37+
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
3038

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

34-
# Install only required dependencies for DallasTemperature library
42+
# Install only required dependencies for DallasTemperature library and others
3543
RUN arduino-cli lib install \
3644
"OneWire" \
3745
"ArduinoUnit" # For testing
@@ -43,13 +51,27 @@ RUN arduino-cli lib list
4351
COPY update-libraries.sh /usr/local/bin/
4452
RUN chmod +x /usr/local/bin/update-libraries.sh
4553

46-
# Add aliases for build operations
54+
# Add aliases for build operations (for Bash)
4755
RUN echo 'alias arduino-build="./build.sh build"' >> /home/vscode/.bashrc && \
4856
echo 'alias arduino-test="./build.sh test"' >> /home/vscode/.bashrc && \
4957
echo 'alias arduino-build-test="./build.sh all"' >> /home/vscode/.bashrc
5058

51-
# Add welcome message to .bashrc
59+
# Add a welcome message to .bashrc
5260
RUN echo '\n# Welcome to the dev container! Here are some useful aliases:' >> /home/vscode/.bashrc && \
5361
echo 'echo " - arduino-build: Build the project"' >> /home/vscode/.bashrc && \
5462
echo 'echo " - arduino-test: Run tests for the project"' >> /home/vscode/.bashrc && \
5563
echo 'echo " - arduino-build-test: Build and test the project"' >> /home/vscode/.bashrc
64+
65+
# (Optional) Add fish-specific configuration if desired
66+
# For example, you might add an alias file or welcome message for fish:
67+
RUN mkdir -p /home/vscode/.config/fish && \
68+
echo 'set -gx PATH /usr/local/bin $PATH' >> /home/vscode/.config/fish/config.fish && \
69+
echo '# Welcome to the Fish shell inside the dev container!' >> /home/vscode/.config/fish/config.fish
70+
71+
# Generate SSH keys and set proper ownership and permissions
72+
RUN if [ ! -f /home/vscode/.ssh/id_rsa ]; then \
73+
ssh-keygen -t rsa -b 4096 -N "" -C "devcontainer@local" -f /home/vscode/.ssh/id_rsa && \
74+
chmod 600 /home/vscode/.ssh/id_rsa && \
75+
chmod 644 /home/vscode/.ssh/id_rsa.pub && \
76+
chown vscode:vscode /home/vscode/.ssh/id_rsa /home/vscode/.ssh/id_rsa.pub ; \
77+
fi

.devcontainer/arduino-cli.yaml

+5-1
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

+15-7
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+

DallasTemperature.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef DallasTemperature_h
22
#define DallasTemperature_h
33

4-
#define DALLASTEMPLIBVERSION "4.0.3"
4+
#define DALLASTEMPLIBVERSION "4.0.4"
55

66
// Configuration
77
#ifndef REQUIRESNEW

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"paulstoffregen/OneWire": "^2.3.5"
3434
},
35-
"version": "4.0.3",
35+
"version": "4.0.4",
3636
"frameworks": "arduino",
3737
"platforms": "*"
3838
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=DallasTemperature
2-
version=4.0.3
2+
version=4.0.4
33
author=Miles Burton <[email protected]>, Tim Newsome <[email protected]>, Guil Barros <[email protected]>, Rob Tillaart <[email protected]>
44
maintainer=Miles Burton <[email protected]>
55
sentence=Arduino library for Dallas/Maxim temperature ICs

0 commit comments

Comments
 (0)