Vscode/Github Codespaces dev container (#4975)

* vscode/Github Codespaces dev container

* move badge to new line

* actually move badge to new line

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
Jinto Jose
2023-06-09 06:44:58 -07:00
committed by GitHub
parent 2558bfec83
commit 19d1a9a067
4 changed files with 127 additions and 0 deletions

79
.devcontainer/Dockerfile vendored Normal file
View File

@@ -0,0 +1,79 @@
# SETUP PYTHON IMAGE
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/python:0-3.10-bullseye AS python
LABEL org.opencontainers.image.source https://github.com/OpenBB-finance/OpenBBTerminal
# SETUP DEBIAN IMAGE
FROM python as debian
RUN apt-get update
RUN apt-get -y install --no-install-recommends \
gcc \
g++ \
make
RUN apt-get -y install --no-install-recommends \
git
RUN apt-get -y install --no-install-recommends \
curl \
wget
RUN apt-get -y install --no-install-recommends \
libsm6 \
libxt6 \
libgl1-mesa-glx \
libpng16-16 \
libwebkit2gtk-4.0-dev \
build-essential \
libssl-dev \
librsvg2-dev \
ffmpeg \
python3-tk
RUN apt-get clean
USER vscode
WORKDIR /home/vscode
# SETUP POETRY IMAGE
FROM debian as poetry
ENV PATH="/home/vscode/.local/bin:${PATH}"
# Define the version of Poetry to install (default is 1.4.2)
# Define the directory of python virtual environment
ARG PYTHON_VIRTUALENV_HOME=/home/vscode/openbb-py-env \
POETRY_VERSION=1.4.0
ENV POETRY_VIRTUALENVS_IN_PROJECT=false \
POETRY_NO_INTERACTION=true
# Create a Python virtual environment for Poetry and install it
RUN python3 -m venv ${PYTHON_VIRTUALENV_HOME} && \
$PYTHON_VIRTUALENV_HOME/bin/pip install --upgrade pip wheel && \
$PYTHON_VIRTUALENV_HOME/bin/pip install poetry==${POETRY_VERSION}
ENV PATH="$PYTHON_VIRTUALENV_HOME/bin:$PATH" \
VIRTUAL_ENV=$PYTHON_VIRTUALENV_HOME
# Setup for bash
RUN poetry completions bash >> /home/vscode/.bash_completion && \
echo "export PATH=$PYTHON_VIRTUALENV_HOME/bin:$PATH" >> ~/.bashrc
# SETUP OPENBB IMAGE
FROM poetry as openbb-dev
COPY --chown=vscode:vscode pyproject.toml poetry.lock ./
RUN mkdir OpenBBUserData
RUN chown vscode:vscode OpenBBUserData
RUN mkdir .openbb_terminal
RUN chown vscode:vscode .openbb_terminal
RUN poetry install --no-root --extras optimization --extras forecast
# Set the working directory for the app
WORKDIR /workspaces/openbb

33
.devcontainer/devcontainer.json vendored Normal file
View File

@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"dockerComposeFile": "./docker-compose.yaml",
"service": "openbb",
"workspaceFolder": "/workspaces/openbb",
"name": "openbb",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
],
"settings": {
"python.defaultInterpreterPath": "/home/vscode/openbb-py-env/bin/python"
}
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
"remoteUser": "vscode",
"overrideCommand": true
}

11
.devcontainer/docker-compose.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: '3.8'
services:
openbb:
volumes:
- ~/OpenBBUserData:/home/vscode/OpenBBUserData
- ~/.openbb_terminal:/home/vscode/.openbb_terminal
- ../:/workspaces/openbb
platform: linux/amd64
build:
dockerfile: .devcontainer/Dockerfile
context: ../

4
README.md vendored
View File

@@ -23,6 +23,10 @@
![Discord Shield](https://discordapp.com/api/guilds/831165782750789672/widget.png?style=shield)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/openbb_finance.svg?style=social&label=Follow%20%40openbb_finance)](https://twitter.com/openbb_finance)
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/OpenBB-finance/OpenBBTerminal)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/OpenBB-finance/OpenBBTerminal)
<!-- PROJECT LOGO -->
| OpenBB is committed to build the future of investment research by focusing on an open source infrastructure accessible to everyone, everywhere. |