From d30b98d80b957ab4debc830a996c129306aaa4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 27 Dec 2024 12:48:04 +0100 Subject: [PATCH] Add documentation Format files --- .github/workflows/build-push-docker-image.yml | 4 +-- build-scripts/README.md | 26 +++++++++++++++++-- build-scripts/build-and-push-docker-image.sh | 6 ++--- docker/README.md | 6 +++-- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index 8b2a51d7e500b..27850f6221610 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -103,7 +103,7 @@ jobs: with: path: ${{env.docker_path }} merge-multiple: true - + - name: Display structure of downloaded files run: ls -lR ${{env.docker_path }} @@ -116,5 +116,3 @@ jobs: QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} run: | bash build-scripts/build-and-push-docker-image.sh -n ${{ needs.call-build-workflow.outputs.name }} - - # echo ${{ needs.job1.outputs.firstword }} diff --git a/build-scripts/README.md b/build-scripts/README.md index b249938e4f3e9..04005f36bc955 100644 --- a/build-scripts/README.md +++ b/build-scripts/README.md @@ -39,6 +39,28 @@ The resulting package will be stored at `wazuh-indexer/artifacts/dist`. > The `STAGE` option defines the naming of the package. When set to `false`, the package will be unequivocally named with the commits' SHA of the `wazuh-indexer`, `wazuh-indexer-plugins` and `wazuh-indexer-reporting` repositories, in that order. For example: `wazuh-indexer_5.0.0-0_x86_64_aff30960363-846f143-494d125.rpm`. -## Building wazuh-indexer docker images +## Building wazuh-indexer Docker images -> TBD. For manual building refer to [our Docker containers guide](../docker/README.md). +The `build-and-push-docker-image.sh` script automates the process to build and push Wazuh Indexer Docker images to our repository in quay.io. The script takes serveral parameters. Use the `-h` option to display them. + +The Docker image is built from a wazuh-indexer tarball (tar.gz), which must be present in the same folder as the Dockerfile in `wazuh-indexer/docker/prod`. + +To push images, credentials must be set at environment level: + +- QUAY_USERNAME +- QUAY_TOKEN + +```bash +Usage: build-scripts/build-and-push-docker-image.sh [args] + +Arguments: +-n NAME [required] Tarball name. +-r REVISION [Optional] Revision qualifier, default is 0. +-h help +``` + +The script will stop if the credentials are not set, or if any of the required parameters are not provided. + +This script is used in the `build-push-docker-image.yml` **GitHub Workflow**, which is used to automate the process even more. When possible, **prefer this method**. + +For manual building refer to [our Docker containers guide](../docker/README.md). diff --git a/build-scripts/build-and-push-docker-image.sh b/build-scripts/build-and-push-docker-image.sh index 79b53abca1c1c..9897eb674d992 100644 --- a/build-scripts/build-and-push-docker-image.sh +++ b/build-scripts/build-and-push-docker-image.sh @@ -1,7 +1,7 @@ #!/bin/bash # This script builds and pushes wazuh-indexer docker images to the quay.io registry. -# The Docker image is built from a wazuh-indexer tarball (tar.gz), which must be +# The Docker image is built from a wazuh-indexer tarball (tar.gz), which must be # present in the same folder as the Dockerfile in wazuh-indexer/docker/prod. # For addtional information, read these documents: # - wazuh-indexer/docker/README.md @@ -10,9 +10,9 @@ # To push images, credentials must be set at environment level: # - QUAY_USERNAME # - QUAY_TOKEN -# +# # Usage: build-scripts/build-and-push-docker-image.sh [args] -# + # Arguments: # -n NAME [required] Tarball name. # -r REVISION [Optional] Revision qualifier, default is 0. diff --git a/docker/README.md b/docker/README.md index 7e5d72140bb96..6d319cd1d1924 100644 --- a/docker/README.md +++ b/docker/README.md @@ -45,15 +45,17 @@ Refer to [build-scripts/README.md](../build-scripts/README.md) for details about The [prod](./prod) folder contains the code to build Docker images. A tarball of `wazuh-indexer` needs to be located at the same level that the Dockerfile. Below there is an example of the command needed to build the image. Set the build arguments and the image tag accordingly. ```bash -docker build --build-arg="VERSION=5.0.0" --build-arg="INDEXER_TAR_NAME=wazuh-indexer-5.0.0-1_linux-x64_cfca84f.tar.gz" --tag=wazuh-indexer:5.0.0 --progress=plain --no-cache . +docker build --build-arg="VERSION=5.0.0" --build-arg="INDEXER_TAR_NAME=wazuh-indexer_5.0.0-0_linux-x64.tar.gz" --tag=wazuh-indexer:5.0.0-0 --progress=plain --no-cache . ``` Then, start a container with: ```bash -docker run -it --rm wazuh-indexer:5.0.0 +docker run -p 9200:9200 -it --rm quay.io/wazuh/wazuh-indexer:5.0.0-latest ``` +Refer to [build-scripts/README.md](../build-scripts/README.md) for details about how to build and push Wazuh Indexer Docker images. + [docker]: https://docs.docker.com/engine/install