|
| 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"] |
0 commit comments