Skip to content

Added build container #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignire
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github
.vscode*

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
run: |
export NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js
- name: Build and pack extension
- name: Build and pack extension (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
$env:NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
Expand Down
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ vendor/**
azure-pipelines.yml
build/**
assets/platform/**
.dockerignore
Dockerfile

# A platform-specific directory in assets/platform/ will be added to the end of
# this file by the packaging script.
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM ubuntu:23.10

# # set timezone ?
RUN ln -snf /usr/share/zoneinfo/Etc/Universal /etc/localtime

# install utility packages
RUN apt update
RUN apt install -y openssh-server openssh-sftp-server bash sudo zsh net-tools vim git python3.11 curl wget
SHELL ["/bin/bash", "-c"]

# install node js
ENV NVM_DIR=/usr/local/nvm
ENV NODE_VERSION=18.20.4
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
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH


# install project tool dependancies
RUN npm install -g gulp node-gyp @vscode/vsce
RUN apt install -y g++-multilib build-essential libudev-dev unzip

# SSHD configuration
EXPOSE 22/tcp
RUN mkdir -p /var/run/sshd


# Volume configuration
VOLUME ["/host_dir"]

# User configuration
RUN usermod --shell /bin/bash -aG sudo ubuntu
WORKDIR /home/ubuntu
USER ubuntu:ubuntu

# configure powerlevel10k
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
RUN echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

# copy the repository into the container
COPY --chown=ubuntu:ubuntu . /vscode-arduino

# clone arduino tools
RUN wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/ubuntu
RUN node /vscode-arduino/build/checkHash.js /home/ubuntu/arduino-1.8.19-linux64.tar.xz eb68bddc1d1c0120be2fca1350a03ee34531cf37f51847b21210b6e70545bc9b
RUN tar -xvf /home/ubuntu/arduino-1.8.19-linux64.tar.xz -C /home/ubuntu
USER root:root
RUN ln -s /home/ubuntu/arduino-1.8.19/arduino /usr/bin/arduino
USER ubuntu:ubuntu

# install npm dependencies
WORKDIR /vscode-arduino
ENV CXX="g++"
ENV CC="gcc"
RUN npm install

WORKDIR /home/ubuntu
USER root:root
RUN cat ~/.bashrc >> .bashrc
RUN echo "export NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules" >> .bashrc
RUN echo "export PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH" >> .bashrc
RUN echo "export NODE_OPTIONS=\"--openssl-legacy-provider --no-experimental-fetch\"" >> .bashrc
RUN echo "source $NVM_DIR/nvm.sh" >> .bashrc
RUN cat .bashrc >> .zshrc
ENTRYPOINT ["/bin/bash", "-c", "/usr/sbin/sshd && su ubuntu"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ To *run and develop*, do the following:

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

You can also use `docker buid -t vscode-arduino:0.7.1 .` in order to create a container to compile the codebase
Then you can run `docker run --name vscode_arduino_builder -it -v <some local folder>:/host_dir vscode-arduino:0.7.1`

## Code of Conduct
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.

Expand Down
Loading