From 89c18d1121745c1802544d1e435d9b842cbc1d39 Mon Sep 17 00:00:00 2001 From: Luigi Pellecchia Date: Wed, 22 Jan 2025 22:29:13 +0000 Subject: [PATCH] Renamed Dockerfile to Containerfile, updated documentation to mention podman commands Signed-off-by: Luigi Pellecchia --- Dockerfile-api => Containerfile-api | 2 - Dockerfile-app => Containerfile-app | 2 - docs/source/how_to_run_it.rst | 79 +++++++++++++++-------------- 3 files changed, 42 insertions(+), 41 deletions(-) rename Dockerfile-api => Containerfile-api (97%) rename Dockerfile-app => Containerfile-app (94%) diff --git a/Dockerfile-api b/Containerfile-api similarity index 97% rename from Dockerfile-api rename to Containerfile-api index 854d1ed..6deb97c 100644 --- a/Dockerfile-api +++ b/Containerfile-api @@ -1,5 +1,3 @@ -# syntax=docker/dockerfile:1 - FROM registry.fedoraproject.org/fedora:39 USER root RUN mkdir BASIL-API diff --git a/Dockerfile-app b/Containerfile-app similarity index 94% rename from Dockerfile-app rename to Containerfile-app index dfe744f..7626a54 100644 --- a/Dockerfile-app +++ b/Containerfile-app @@ -1,5 +1,3 @@ -# syntax=docker/dockerfile:1 - FROM node:16 USER root RUN mkdir BASIL-APP diff --git a/docs/source/how_to_run_it.rst b/docs/source/how_to_run_it.rst index 228e244..db355c7 100644 --- a/docs/source/how_to_run_it.rst +++ b/docs/source/how_to_run_it.rst @@ -20,10 +20,10 @@ Architecture ----------------- -Docker Containers +Podman Containers ----------------- -You can deploy BASIL via Docker using Dockerfile-api and Dockerfile-app provided as part of the source code. +You can deploy BASIL via podman using Containerfile-api and Containerfile-app provided as part of the source code. Or you can download images built in the [GitHub actions](https://github.com/elisa-tech/BASIL/actions). Pay attention that those images are built with default value of build argument, as an example the ADMIN user password. @@ -32,7 +32,7 @@ So it is suggested to use those images for evaluation or to modify them, changin # Build the Containers ^^^^^^^^^^^^^^^^^^^^^^ -You can build the API project using the Dockerfile-api. +You can build the API project using the Containerfile-api. Building this container you will also initialize the database. @@ -45,18 +45,18 @@ You can specify the **admin** user password with the following build argument: + ADMIN_PASSWORD (default is **admin**) -Here an example of docker build command: +Here an example of podman container build command: .. code-block:: bash - docker build \ + podman build \ --build-arg="ADMIN_PASSWORD=your-desired-password" \ --build-arg="API_PORT=1234" \ - -f Dockerfile-api \ + -f Containerfile-api \ -t basil-api-image . -At the same way you can build the APP project using Dockerfile-app +At the same way you can build the APP project using Containerfile-app To be able to reach the API project you need to specify the following build argument: @@ -65,66 +65,70 @@ To be able to reach the API project you need to specify the following build argu .. code-block:: bash - docker build \ + podman build \ --build-arg="API_ENDPOINT=http://api-server-url:yourport" \ --build-arg="APP_PORT=yourport" \ - -f Dockerfile-app \ + -f Containerfile-app \ -t basil-app-image . NOTE: API_ENDPOINT must start with http -# Docker Volumes -^^^^^^^^^^^^^^^^ +# Volumes +^^^^^^^^^ -In order to keep persistent data you can specify following volumes: +In order to keep persistent data across deployments you can specify following volumes: .. code-block:: bash - docker volume create basil-db-vol - docker volume create basil-ssh-keys-vol - docker volume create basil-tmt-logs-vol + podman volume create basil-db-vol + podman volume create basil-ssh-keys-vol + podman volume create basil-tmt-logs-vol + + podman volume mount basil-db-vol + podman volume mount basil-ssh-keys-vol + podman volume mount basil-tmt-logs-vol # Start the Containers ^^^^^^^^^^^^^^^^^^^^^^ -You can start the API Container above created with the name **basil-api-image** with the following docker command +You can start the API Container above created with the name **basil-api-image** with the following command .. code-block:: bash - docker run \ - -d \ - --privileged \ - --network=host \ - -p 0.0.0.0:: \ - --mount source=basil-db-vol,target=/BASIL-API/db \ - --mount source=basil-ssh-keys-vol,target=/BASIL-API/api/ssh_keys \ - --mount source=basil-tmt-logs-vol,target=/var/tmp/tmt \ - basil-api-image + podman run \ + -d \ + --privileged \ + --network=host \ + -v "basil-db-vol:/BASIL-API/db/sqlite3" \ + -v "basil-ssh-keys-vol:/BASIL-API/api/ssh_keys" \ + -v "basil-tmt-logs-vol:/var/tmp/tmt" \ + --name basil-api-container \ + basil-api-image the ``--privileged`` options is needed to be able to run fedora container as a possible testing environment inside api container. -You can start the APP Container above created with the name **basil-app-image** with the following docker command +You can start the APP Container above created with the name **basil-app-image** with the following command .. code-block:: bash - docker run \ + podman run \ -d \ --network=host \ - -p 0.0.0.0:: \ + --name basil-app-container \ basil-app-image # Check Containers Status ^^^^^^^^^^^^^^^^^^^^^^^^^ -You can list running containers with the following docker command +You can list running containers with the following command .. code-block:: bash - docker ps + podman ps # Inspect an Image @@ -134,7 +138,7 @@ You can inspect an image overriding the --entrypoint .. code-block:: bash - docker run \ + podman run \ --interactive \ --tty \ --network=host \ @@ -144,23 +148,24 @@ You can inspect an image overriding the --entrypoint # Backup BASIL DB from Container ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Only the API project is able to interact with the database and the db and due to that you should refer to the **basil-api** container. -You can copy the db file locally with the following docker command: +Only the API project is able to interact with the database and due to that you should refer to the **basil-api** container. +You can copy the db file locally with the following command: .. code-block:: bash - docker cp basil-api-container:/BASIL-API/db/sqlite3/basil.db + podman cp basil-api-container:/BASIL-API/db/sqlite3/basil.db # Stop Containers ^^^^^^^^^^^^^^^^^ -You can stop running containers, the one that you can see listed with the **ps** docker command using the following syntax: +You can stop running containers, the one that you can see listed with the **ps** command using the following syntax: .. code-block:: bash - docker stop - docker stop + podman stop + podman stop +NOTE: above mentioned commands are tested on fedora 37 x86_64 virutal machine with podman version 4.2.1 .. toctree:: :maxdepth: 1