Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
Format files
  • Loading branch information
AlexRuiz7 committed Dec 27, 2024
1 parent dc2256a commit d30b98d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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 }}
26 changes: 24 additions & 2 deletions build-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
6 changes: 3 additions & 3 deletions build-scripts/build-and-push-docker-image.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- Links -->

[docker]: https://docs.docker.com/engine/install
Expand Down

0 comments on commit d30b98d

Please sign in to comment.