Skip to content

Commit

Permalink
Included the content of the file /docker/README.md into /build-script…
Browse files Browse the repository at this point in the history
…s/README.md, along with minor modifications to fix errors.
  • Loading branch information
Jorgesnchz committed Feb 13, 2025
1 parent 0cef72a commit 4c77a7e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
run: ls -lR ${{env.docker_path }}

- name: Set up Docker Buildx
uses: build-scripts/setup-buildx-action@v3
uses: docker/setup-buildx-action@v3

- name: Build and push
env:
Expand Down
33 changes: 33 additions & 0 deletions build-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ The process to build packages requires Docker and Docker Compose.

Before you get started, make sure to clean your environment by running `./gradlew clean`.

## Pre-requisites

1. Install [Docker](https://docs.docker.com/engine/install/) as per its instructions.

2. Your workstation must meet the minimum hardware requirements:

- 8 GB of RAM (minimum)
- 4 cores

The more resources the better ☺

3. Clone the [wazuh-indexer](https://github.com/wazuh/wazuh-indexer).
## Building wazuh-indexer packages

The `builder` image automates the build and assemble process for the Wazuh Indexer and its plugins, making it easy to create packages on any system.

Use the script under `wazuh-indexer/build-scripts/builder/builder.sh` to build a package.

```bash
Expand All @@ -35,12 +49,31 @@ Arguments:
-h Print help
```

In the example below, it will generate a wazuh-indexer package for Debian based systems, for the x64 architecture, using 1 as revision number and using the production naming convention.

```bash
# Wihtin wazuh-indexer/build-scripts/builder
bash builder.sh -d deb -a x64 -R 1 -s true
```

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

The [docker](./docker) 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-0_linux-x64.tar.gz" --tag=wazuh-indexer:5.0.0-0 --progress=plain --no-cache .
```

Then, start a container with:

```bash
docker run -p 9200:9200 -it --rm quay.io/wazuh/wazuh-indexer:5.0.0-latest
```

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/build-scripts/docker`.
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN mkdir -p /repositories/wazuh-indexer-plugins && \
chown wazuh-indexer:wazuh-indexer /repositories/wazuh-indexer-reporting

# Copy your build scripts into the container as root
COPY docker/builder/entrypoint.sh /
COPY build-scripts/builder/entrypoint.sh /

# Change file permissions as root
RUN chmod +x /entrypoint.sh
Expand Down

0 comments on commit 4c77a7e

Please sign in to comment.