Co-authored-by: Chavithra <chavithra@gmail.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
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:
- Enter the OpenBB directory
cd ~/OpenbbTerminal - Open
docker/compose.envand setOPENBBTERMINAL_DOCKER_RELEASE_VERSIONto the desired version - Load the environment variables
bash compose/env - 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
python.dockerfile: builds a docker image with a slim-bullseye python3.9 environment. It then labels the image and installs python and poetry.poetry-deps.dockerfile: imports everything from the previous build, adds a label, and then install the poetry dependencies.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.