Files
OpenBB/docker
Chavithra 67a50d92c7 Docker + Pypi : update logs + builds (#3016)
* Log : move LOGGING_COMMIT_HASH

* Build : pypi

* Build : docker

* Poetry : pyproject.toml

* Docker : test cd

* Docker : test cd

* Docker : test cd

* Docker : update cd

* Docker : update workflow

* Docker : remove script

* Tests : loggers

* Docker : workflow

* Pypi : build script

* Pypi : adding MANIFEST.in

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
2022-10-26 12:43:05 +01:00
..
2022-10-22 22:25:25 -04:00
2022-10-22 22:25:25 -04:00

OpenBBTerminal Docker

These files create our docker images. To use docker read this.

Building the Docker Image

Building the Docker image can be done easily. The following steps allow users to create a docker image on their local machine:

  1. Enter the OpenBB directory cd ~/OpenbbTerminal
  2. Open docker/compose.env and set OPENBBTERMINAL_DOCKER_RELEASE_VERSION to the desired version
  3. Load the environment variables bash compose/env
  4. Run the build script bash docker/build.sh

Note: The build.sh script requires bash 5.0 or newer.

Testing the Docker Image

Integration and unit tests can be run on the new docker image. Before running either set of tests you need to start up an image with:

  • docker run -it --rm ghcr.io/[BUILD_NAME]

Leave the terminal open and then navigate docker desktop. Find the currently running image and select open in terminal. Now:

  • For integration tests run: poetry run python terminal.py scripts -t
  • For unit tests run poetry run pytest tests/

Setup Explanation

The three docker files (python.dockerfile, poetry-deps.dockerfile, and poetry.dockerfile) build off of each other to improving caching. A greater description of each stage is below

  1. python.dockerfile: builds a docker image with a slim-bullseye python3.9 environment. It then labels the image and installs python and poetry.
  2. poetry-deps.dockerfile: imports everything from the previous build, adds a label, and then install the poetry dependencies.
  3. poetry.dockerfile: imports the poetry dependencies, adds its own label, and then starts an instance of the terminal

The build.sh file creates each of these images in the correct order, and populates the correct arguments based on what is provided in compose.env.