mirror of
https://github.com/freqtrade/frequi.git
synced 2024-09-20 01:21:08 +00:00
Merge pull request #12 from freqtrade/dev_container_vs_code
dev container support for vs code on linux
This commit is contained in:
commit
60545255d8
56
.devcontainer/Dockerfile
Normal file
56
.devcontainer/Dockerfile
Normal file
|
@ -0,0 +1,56 @@
|
|||
FROM node:12-slim as dev
|
||||
|
||||
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
|
||||
|
||||
WORKDIR $HOME/frequi
|
||||
|
||||
COPY ./package.json .
|
||||
|
||||
# install dependencies
|
||||
RUN yarn install
|
||||
RUN yarn global add @vue/cli
|
||||
|
||||
USER $USERNAME
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
FROM dev as vscode
|
||||
|
||||
WORKDIR $HOME
|
||||
|
||||
# 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=
|
||||
|
||||
|
||||
|
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* cSpell:disable */
|
||||
{
|
||||
"name": "frequi",
|
||||
"dockerComposeFile": ["docker-compose.yml","docker-compose.vscode.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",
|
||||
]
|
||||
}
|
17
.devcontainer/docker-compose.vscode.yml
Normal file
17
.devcontainer/docker-compose.vscode.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
version: '3.4'
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
target: vscode
|
||||
image: freqtradeorg/frequi:vscode
|
||||
volumes:
|
||||
- "/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
|
||||
|
||||
volumes:
|
||||
frequi-bashhistory:
|
||||
frequi-vscode-server:
|
||||
frequi-server-insiders:
|
20
.devcontainer/docker-compose.yml
Normal file
20
.devcontainer/docker-compose.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
version: '3.4'
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ..
|
||||
target: dev
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
image: freqtradeorg/frequi:dev
|
||||
user: dev
|
||||
volumes:
|
||||
- ../node_modules:/home/dev/frequi/node_modules
|
||||
- ../:/home/dev/frequi
|
||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
||||
networks:
|
||||
- frequi
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
networks:
|
||||
frequi:
|
44
README.md
44
README.md
|
@ -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,44 @@ npm run lint
|
|||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
|
||||
## Project setup for docker (developing inside dev container) without vscode
|
||||
|
||||
### Built dev docker image and run container(s) detached
|
||||
|
||||
```
|
||||
cd .devcontainer
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Go inside web service container and serve
|
||||
|
||||
```
|
||||
docker-compose exec web /bin/bash
|
||||
```
|
||||
|
||||
then
|
||||
|
||||
```
|
||||
yarn serve
|
||||
```
|
||||
|
||||
## Project setup for vscode and docker (developing inside dev container) 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
|
||||
|
||||
### Serve your local server
|
||||
|
||||
```
|
||||
yarn serve
|
||||
```
|
||||
|
||||
You now have useful vscode extentions, git support, your command history of the project.
|
Loading…
Reference in New Issue
Block a user