Skip to content

Commit 6fe7b91

Browse files
authored
Added build container (#29)
1 parent d65b8eb commit 6fe7b91

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

.dockerignire

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.github
2+
.vscode*
3+

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
run: |
8484
export NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
8585
node build/package.js
86-
- name: Build and pack extension
86+
- name: Build and pack extension (windows)
8787
if: ${{ matrix.os == 'windows-latest' }}
8888
run: |
8989
$env:NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"

.vscodeignore

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ vendor/**
1919
azure-pipelines.yml
2020
build/**
2121
assets/platform/**
22+
.dockerignore
23+
Dockerfile
2224

2325
# A platform-specific directory in assets/platform/ will be added to the end of
2426
# this file by the packaging script.

Dockerfile

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
FROM ubuntu:23.10
2+
3+
# # set timezone ?
4+
RUN ln -snf /usr/share/zoneinfo/Etc/Universal /etc/localtime
5+
6+
# install utility packages
7+
RUN apt update
8+
RUN apt install -y openssh-server openssh-sftp-server bash sudo zsh net-tools vim git python3.11 curl wget
9+
SHELL ["/bin/bash", "-c"]
10+
11+
# install node js
12+
ENV NVM_DIR=/usr/local/nvm
13+
ENV NODE_VERSION=18.20.4
14+
RUN mkdir -p $NVM_DIR && export NVM_DIR=$NVM_DIR && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
15+
RUN source $NVM_DIR/nvm.sh \
16+
&& nvm install $NODE_VERSION \
17+
&& nvm alias default $NODE_VERSION \
18+
&& nvm use default
19+
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
20+
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
21+
22+
23+
# install project tool dependancies
24+
RUN npm install -g gulp node-gyp @vscode/vsce
25+
RUN apt install -y g++-multilib build-essential libudev-dev unzip
26+
27+
# SSHD configuration
28+
EXPOSE 22/tcp
29+
RUN mkdir -p /var/run/sshd
30+
31+
32+
# Volume configuration
33+
VOLUME ["/host_dir"]
34+
35+
# User configuration
36+
RUN usermod --shell /bin/bash -aG sudo ubuntu
37+
WORKDIR /home/ubuntu
38+
USER ubuntu:ubuntu
39+
40+
# configure powerlevel10k
41+
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
42+
RUN echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
43+
44+
# copy the repository into the container
45+
COPY --chown=ubuntu:ubuntu . /vscode-arduino
46+
47+
# clone arduino tools
48+
RUN wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/ubuntu
49+
RUN node /vscode-arduino/build/checkHash.js /home/ubuntu/arduino-1.8.19-linux64.tar.xz eb68bddc1d1c0120be2fca1350a03ee34531cf37f51847b21210b6e70545bc9b
50+
RUN tar -xvf /home/ubuntu/arduino-1.8.19-linux64.tar.xz -C /home/ubuntu
51+
USER root:root
52+
RUN ln -s /home/ubuntu/arduino-1.8.19/arduino /usr/bin/arduino
53+
USER ubuntu:ubuntu
54+
55+
# install npm dependencies
56+
WORKDIR /vscode-arduino
57+
ENV CXX="g++"
58+
ENV CC="gcc"
59+
RUN npm install
60+
61+
WORKDIR /home/ubuntu
62+
USER root:root
63+
RUN cat ~/.bashrc >> .bashrc
64+
RUN echo "export NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules" >> .bashrc
65+
RUN echo "export PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH" >> .bashrc
66+
RUN echo "export NODE_OPTIONS=\"--openssl-legacy-provider --no-experimental-fetch\"" >> .bashrc
67+
RUN echo "source $NVM_DIR/nvm.sh" >> .bashrc
68+
RUN cat .bashrc >> .zshrc
69+
ENTRYPOINT ["/bin/bash", "-c", "/usr/sbin/sshd && su ubuntu"]

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ To *run and develop*, do the following:
231231

232232
To *test*, press <kbd>F5</kbd> in VS Code with the "Launch Tests" debug configuration.
233233

234+
You can also use `docker buid -t vscode-arduino:0.7.1 .` in order to create a container to compile the codebase
235+
Then you can run `docker run --name vscode_arduino_builder -it -v <some local folder>:/host_dir vscode-arduino:0.7.1`
236+
234237
## Code of Conduct
235238
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct). For more information please see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/#howadopt) or contact opencode@microsoft.com with any additional questions or comments.
236239

0 commit comments

Comments
 (0)