forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
# Start container with required tools to build packages | ||
# Requires Docker | ||
# Script usage: bash ./builder.sh | ||
|
||
set -e | ||
|
||
# ==== | ||
# Checks that the script is run from the intended location | ||
# ==== | ||
function check_project_root_folder() { | ||
current=$(basename "$(pwd)") | ||
|
||
if [[ "$0" != "./builder.sh" && "$0" != "builder.sh" ]]; then | ||
echo "Run the script from its location" | ||
usage | ||
exit 1 | ||
fi | ||
# Change working directory to the root of the repository | ||
cd ../.. | ||
} | ||
|
||
# ==== | ||
# Displays usage | ||
# ==== | ||
function usage() { | ||
echo "Usage: ./builder.sh {up|down|stop}" | ||
} | ||
|
||
# ==== | ||
# Main function | ||
# ==== | ||
function main() { | ||
check_project_root_folder "$@" | ||
compose_file="docker/${current}/compose.yml" | ||
compose_cmd="docker compose -f $compose_file" | ||
REPO_PATH=$(pwd) | ||
VERSION=$(cat VERSION) | ||
export REPO_PATH | ||
export VERSION | ||
|
||
case $1 in | ||
up) | ||
# Main folder created here to grant access to both containers | ||
mkdir -p artifacts | ||
$compose_cmd up -d --build | ||
;; | ||
down) | ||
$compose_cmd down -v | ||
;; | ||
stop) | ||
$compose_cmd stop | ||
;; | ||
*) | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
services: | ||
|
||
wazuh-indexer-builder: | ||
image: wazuh-indexer-builder:${VERSION} | ||
container_name: wazuh-indexer-builder_${VERSION} | ||
build: | ||
context: ./../.. | ||
dockerfile: ${REPO_PATH}/docker/builder/Dockerfile | ||
volumes: | ||
- ${REPO_PATH}:/home/wazuh-indexer | ||
#entrypoint: ["/bin/bash", "/home/wazuh-indexer/entrypoint.sh"] | ||
entrypoint: ["tail", "-f", "/dev/null"] | ||
user: "1000:1000" | ||
working_dir: /home/wazuh-indexer | ||
|
||
# wi-assemble: | ||
# image: wi-assemble:${VERSION} | ||
# container_name: wi-assemble_${VERSION} | ||
# build: | ||
# context: ./../.. | ||
# dockerfile: ${REPO_PATH}/docker/builder/Dockerfile | ||
# volumes: | ||
# - ${REPO_PATH}/build-scripts:/home/wazuh-indexer/build-scripts | ||
# - ${REPO_PATH}/artifacts:/home/wazuh-indexer/artifacts | ||
# - ${REPO_PATH}/distribution/packages/src:/home/wazuh-indexer/distribution/packages/src | ||
# - ${REPO_PATH}/buildSrc:/home/wazuh-indexer/buildSrc | ||
# entrypoint: ["tail", "-f", "/dev/null"] | ||
# user: "1000:1000" | ||
# working_dir: /home/wazuh-indexer |