Skip to content
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

[Feature] Create openbb-cli .dockerfile and update docs #6485

Merged
merged 5 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
47 changes: 47 additions & 0 deletions build/docker/cli.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ---- Base Python ----
FROM python:3.11-slim-bullseye AS base

# set work directory
WORKDIR /openbb

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential openssh-client curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# install toml and poetry
RUN pip install toml poetry

# ---- Copy Files/Build ----
FROM base AS builder

WORKDIR /openbb

# install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& apt-get update \
&& apt-get install -y --no-install-recommends libwebkit2gtk-4.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# add Rust to PATH
ENV PATH="/root/.cargo/bin:${PATH}"

COPY ./cli ./cli

# Install the SDK
RUN pip install /openbb/cli
RUN pip install openbb-devtools

# ---- Copy Files ----
FROM base

COPY --from=builder /usr/local /usr/local

# Launch OpenBB CLI
CMD ["openbb"]
deeleeramone marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

COPY ./openbb_platform ./openbb_platform

# Install the SDK
# Install the Platform
RUN pip install /openbb/openbb_platform[all]
RUN pip install openbb-devtools

Expand All @@ -43,5 +43,5 @@

COPY --from=builder /usr/local /usr/local

# Specify the command to run
# Launch the API
CMD ["uvicorn", "openbb_core.api.rest_api:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
23 changes: 22 additions & 1 deletion website/content/cli/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Next, install webkit.

- Fedora: `sudo dnf install gtk3-devel webkit2gtk3-devel`


## PyPI

Within your existing OpenBB environment, install `openbb-cli` with:
Expand All @@ -67,6 +66,28 @@ openbb
Welcome to OpenBB Platform CLI v1.0.0
```

## Docker

You can install the Platform CLI from [GitHub Container Registry](https://github.com/orgs/OpenBB-finance/packages/container/package/openbb-cli) with:

```bash
docker run -it --rm -v ~/.openbb_platform:/root/.openbb_platform ghcr.io/openbb-finance/openbb-cli:latest
```

Alternatively, we provide a `.dockerfile` on [GitHub](https://github.com/OpenBB-finance/OpenBBTerminal).

Run the following command from the repo root to build the image:

```bash
docker build -f build/docker/cli.dockerfile -t openbb-cli:latest .
```

To run it:

```bash
docker run -it -v ~/.openbb_platform:/root/.openbb_platform openbb-platform:latest
```

## Source

Follow the instructions [here](/platform/installation#source) to clone the GitHub repo and install the OpenBB Platform from the source code.
Expand Down
11 changes: 9 additions & 2 deletions website/content/platform/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,19 @@ pip uninstall openbb[all]
### Docker

<details>
OpenBB provides a `.dockerfile` on [GitHub](https://github.com/OpenBB-finance/OpenBBTerminal).

You can install and run the Platform from [GitHub Container Registry](https://github.com/OpenBB-finance/OpenBBTerminal/pkgs/container/openbb-platform) with:

```bash
docker run --rm -p 8000:8000 -v ~/.openbb_platform:/root/.openbb_platform ghcr.io/openbb-finance/openbb-platform:latest
```

Alternatively, we provide a `.dockerfile` on [GitHub](https://github.com/OpenBB-finance/OpenBBTerminal).

Run the following command from the repo root to build the image:

```bash
docker build -f build/docker/api.dockerfile -t openbb-platform:latest .
docker build -f build/docker/platform.dockerfile -t openbb-platform:latest .
```

To run it:
Expand Down
Loading