Skip to content

Commit

Permalink
Renamed Dockerfile to Containerfile, updated documentation to mention…
Browse files Browse the repository at this point in the history
… podman commands

Signed-off-by: Luigi Pellecchia <[email protected]>
  • Loading branch information
Luigi Pellecchia committed Jan 22, 2025
1 parent e7441d5 commit 89c18d1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 41 deletions.
2 changes: 0 additions & 2 deletions Dockerfile-api → Containerfile-api
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# syntax=docker/dockerfile:1

FROM registry.fedoraproject.org/fedora:39
USER root
RUN mkdir BASIL-API
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile-app → Containerfile-app
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# syntax=docker/dockerfile:1

FROM node:16
USER root
RUN mkdir BASIL-APP
Expand Down
79 changes: 42 additions & 37 deletions docs/source/how_to_run_it.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

Expand All @@ -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:

Expand All @@ -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:<API-PORT>:<Your desired value> \
--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:<APP_PORT>:<Your desired value> \
--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
Expand All @@ -134,7 +138,7 @@ You can inspect an image overriding the --entrypoint

.. code-block:: bash
docker run \
podman run \
--interactive \
--tty \
--network=host \
Expand All @@ -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 </YOUR/LOCAL/LOCATION>
podman cp basil-api-container:/BASIL-API/db/sqlite3/basil.db </YOUR/LOCAL/LOCATION>
# 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 <NAME OF THE API CONTAINER>
docker stop <NAME OF THE APP CONTAINER>
podman stop <NAME OF THE API CONTAINER>
podman stop <NAME OF THE APP CONTAINER>
NOTE: above mentioned commands are tested on fedora 37 x86_64 virutal machine with podman version 4.2.1

.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit 89c18d1

Please sign in to comment.