From dd4c1209b922fe1c1e5f96adcc666afb71c92e45 Mon Sep 17 00:00:00 2001 From: fkolwa Date: Fri, 25 Nov 2022 09:57:40 +0100 Subject: [PATCH] Add documentation --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 53ab56ef..34f108f7 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,22 @@ http://127.0.0.1:5000/apidocs/ by default. The API server will read its configuration on boot from the .env file located in `src/rhelocator/api/.env`. +### How to build the API container on your local system +1. Build the container from within the rhelocator directory: +``` +buildah bud -f ./Containerfile --format docker --tls-verify=true -t rhelocator:latest . +``` + +2. Run the container, forward the Flask default port 5000 and mount a json file containing test data to +`/opt/rhelocator/opt/rhelocator/data/image-data.json`. +``` +podman run -p 5000:5000 -v ./tests/api/testdata/formatted_images.json:/opt/rhelocator/data/image-data.json:Z rhelocator +``` +Mind that this is only meant for local testing and should not run like this in production. The Z operator at the end of the +volume mount is necessary for SELinux and applies the same (MCS)[https://en.wikipedia.org/wiki/Multi_categories_security] +labels to the mounted data that the container will run with. For more information see this former (Project Atomic)[https://projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/] article (now CoreOS). + + ## Running tests Use poetry to run pytest: