dev container support for vs code

This commit is contained in:
gaugau3000 2020-06-04 09:02:46 +00:00
parent 0e2be93a3d
commit 16e9ac7861
4 changed files with 117 additions and 1 deletions

44
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,44 @@
FROM node:12-stretch
ENV DEBIAN_FRONTEND=noninteractive
ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
# utils
&& apt-get -y install git procps lsb-release \
# manage dev user
&& usermod -u 1001 node \
#&& groupadd --gid $USER_GID $USERNAME \
&& useradd -m -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# clean
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV HOME /home/$USERNAME
USER $USERNAME
WORKDIR $HOME
EXPOSE 8080
# load ssh key in bash terminal
RUN echo "eval \$(ssh-agent) && ssh-add ~/.ssh/id_rsa" >> .bashrc
# set variable bash history
RUN echo "export PROMPT_COMMAND='history -a'" >> .bashrc \
&& echo "export HISTFILE=~/commandhistory/.bash_history" >> .bashrc
# ensure folder owned by $USERNAME
RUN mkdir -p .vscode-server .vscode-server-insiders commandhistory
ENV DEBIAN_FRONTEND=

View File

@ -0,0 +1,22 @@
/* cSpell:disable */
{
"name": "frequi",
"dockerComposeFile": "docker-compose.yml",
"service": "web",
"workspaceFolder": "/home/dev/frequi",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"emmet.includeLanguages": {
"vue": "html",
"vue-html": "html"
}
},
"extensions": [
"octref.vetur",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"yzhang.markdown-all-in-one",
"marquesmps.dockerfile-validator",
"streetsidesoftware.code-spell-checker",
]
}

View File

@ -0,0 +1,25 @@
version: '3.4'
services:
web:
build:
context: .
dockerfile: Dockerfile
user: dev
volumes:
- ../:/home/dev/frequi
- "/home/${USER}/.ssh:/home/dev/.ssh:ro"
- "/home/${USER}/.gitconfig:/home/dev/.gitconfig:ro"
- frequi-bashhistory:/home/dev/commandhistory
- frequi-vscode-server:/home/dev/.vscode-server
- frequi-server-insiders:/home/dev/.vscode-server-insiders
command: /bin/sh -c "while sleep 1000; do :; done"
networks:
- frequi
networks:
frequi:
volumes:
frequi-bashhistory:
frequi-vscode-server:
frequi-server-insiders:

View File

@ -8,8 +8,9 @@ This project is still in it's early stages, and is not yet stable nor recommende
It will require Freqtrade to be running on the same host with the API enabled under (`localhost:8081`). This port can be changed in `vue.config.js`.
## Project setup with node install locally
## Project setup
### Project setup
```
npm install
@ -35,3 +36,27 @@ npm run lint
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
## Project setup for vscode and docker (developping inside dev contener) on linux
The goal is it have a complete dev environment very quickly and isolated.
### Install missing tools if needed
Follow [getting strated](https://code.visualstudio.com/docs/remote/containers#_getting-started) section.
### Build your dev container
View > Command palette > Enter: Remote-Containers rebuild container
### Install dependencies and serve your local server
```
yarn install
```
```
yarn serve
```
You now have useful vscode extentions, git support, your command history of the project.