Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify build process using a Docker container #560

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

QU3B1M
Copy link
Member

@QU3B1M QU3B1M commented Nov 21, 2024

Description

Implement a new Docker image to simplify the wazuh-indexer build process.

Usage

  1. Build Docker image
    cd docker/builder && docker build -t wazuh-indexer-builder . && cd ../..
  2. Execute the builder container
    docker run --rm -v ./artifacts/dist:/home/indexer/artifacts wazuh-indexer-builder

Related Issues

Closes: #522

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@QU3B1M QU3B1M self-assigned this Nov 21, 2024
@QU3B1M QU3B1M requested a review from a team as a code owner November 21, 2024 13:47
@AlexRuiz7 AlexRuiz7 marked this pull request as draft November 21, 2024 16:37
@QU3B1M QU3B1M marked this pull request as ready for review November 26, 2024 15:23
@QU3B1M
Copy link
Member Author

QU3B1M commented Nov 26, 2024

Working evidence

  1. Build the docker image

    cd docker/builder && docker build -t wazuh-indexer-builder . && cd ../..                               
    [+] Building 1.6s (15/15) FINISHED                                                                                                                                                  docker:desktop-linux
     => [internal] load build definition from Dockerfile                                                                                                                                                0.0s
     => => transferring dockerfile: 2.43kB                                                                                                                                                              0.0s
     => [internal] load metadata for docker.io/library/ubuntu:noble                                                                                                                                     1.5s
     => [internal] load .dockerignore                                                                                                                                                                   0.0s
     => => transferring context: 1.25kB                                                                                                                                                                 0.0s
     => [ 1/10] FROM docker.io/library/ubuntu:noble@sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295                                                                             0.0s
     => => resolve docker.io/library/ubuntu:noble@sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295                                                                               0.0s
     => [internal] load build context                                                                                                                                                                   0.0s
     => => transferring context: 72B                                                                                                                                                                    0.0s
     => CACHED [ 2/10] RUN apt-get update     && apt-get upgrade -y     && apt-get install -y         wget         curl         unzip         gnupg2         git         build-essential         debma  0.0s
     => CACHED [ 3/10] RUN wget -O- https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz | tar xz -C /opt/                                                                     0.0s
     => CACHED [ 4/10] RUN wget https://services.gradle.org/distributions/gradle-8.10-bin.zip -P /tmp     && unzip -d /opt/gradle /tmp/gradle-8.10-bin.zip     && rm /tmp/gradle-8.10-bin.zip           0.0s
     => CACHED [ 5/10] RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*                                                                                                               0.0s
     => CACHED [ 6/10] RUN useradd -ms /bin/bash indexer && mkdir -p /home/indexer && chown -R indexer:indexer /home/indexer                                                                            0.0s
     => CACHED [ 7/10] ADD entrypoint.sh /home/indexer/                                                                                                                                                 0.0s
     => CACHED [ 8/10] RUN chmod +x /home/indexer/entrypoint.sh                                                                                                                                         0.0s
     => CACHED [ 9/10] RUN mkdir -p /home/indexer/artifacts                                                                                                                                             0.0s
     => CACHED [10/10] WORKDIR /home/indexer                                                                                                                                                            0.0s
     => exporting to image                                                                                                                                                                              0.0s
     => => exporting layers                                                                                                                                                                             0.0s
     => => exporting manifest sha256:e3e61e13d8bdcf43bac6802d4b2915721e0dce5671add085ff8d232097101bd1                                                                                                   0.0s
     => => exporting config sha256:3b71323b0ca3bbe617261daad8f3febebab8bd658397414430790428d11c3451                                                                                                     0.0s
     => => exporting attestation manifest sha256:fa6cb6c3620418875300c0678069f6b8b45370d2fc898fdef118b17845e635b0                                                                                       0.0s
     => => exporting manifest list sha256:394a4cae0664f95ac7e46f404139fef84e828557e2ab465bd1da8da6a7bd3f94                                                                                              0.0s
     => => naming to docker.io/library/wazuh-indexer-builder:latest                                                                                                                                     0.0s
    
    View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/u1lrczc03vvktnsw2e0sk7s3w
  2. Execute the builder

    docker run --rm -e DISTRIBUTION="deb" -v ./artifacts/dist:/home/indexer/artifacts wazuh-indexer-builder
    ---------Starting Build Process---------
    ----------------------------------------
    Cloning Repositories
    ----------------------------------------
    Cloning into '/home/indexer/wazuh-indexer'...
    Cloning into '/home/indexer/wazuh-indexer-plugins'...
    Cloning into '/home/indexer/wazuh-indexer-reporting'...
    ----------------------------------------
    Building Plugins
    ----------------------------------------
    Building setup plugin...
    Downloading https://services.gradle.org/distributions/gradle-8.10-all.zip
    ...
    Moving package to artifacts...
    ----------------------------------------
    Cleaning Up
    ----------------------------------------
    Cleanup completed.
    ----------------------------------------
    Build and Packaging Process Completed Successfully!
    ----------------------------------------
  3. Resulting package:

    ls -ll artifacts/dist                                                                
    total 1722216
    -rw-r--r--  1 quebim_wz  staff  881770660 Nov 26 17:24 wazuh-indexer_5.0.0-0_amd64_47705bc2-715adf9-3e0ef45.deb

@QU3B1M QU3B1M changed the title Add simple Dockerfile for the simplified package builder Simplify wazuh-indexer build process on a Docker environment Nov 26, 2024
@QU3B1M QU3B1M changed the title Simplify wazuh-indexer build process on a Docker environment Simplify build process using a Docker container Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify wazuh-indexer build process
1 participant