Skip to content

Commit

Permalink
Add bash script to build and publish wazuh-indexer docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
QU3B1M committed Oct 17, 2024
1 parent 3bbb4d2 commit ee527ca
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docker/publish_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

## SPDX-License-Identifier: Apache-2.0
## The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

## Usage: ./publish_images.sh <quay-username> <quay-password>

QUAY_IO_USERNAME=$1
QUAY_IO_PASSWORD=$2

build_and_push() {
ENV=$1
IMAGE_NAME="wazuh-indexer"

if [ "$ENV" == "prod" ]; then
TAG="latest"
else
TAG="$ENV"
fi

# Navigate to the Dockerfile directory
cd "$(git rev-parse --show-toplevel)/docker/$ENV"

# Build the Docker image
docker build -t $IMAGE_NAME:$TAG .

# Login to Quay.io
echo $QUAY_IO_PASSWORD | docker login quay.io -u $QUAY_IO_USERNAME --password-stdin

# Push the Docker image to Quay.io
docker push $IMAGE_NAME:$TAG

# Logout from Quay.io
docker logout quay.io

echo "Docker image $IMAGE_NAME:$TAG successfully pushed to quay.io"
}

# Build and push for each environment
build_and_push "ci"
build_and_push "dev"
build_and_push "prod"

echo "All images successfully built and pushed."

0 comments on commit ee527ca

Please sign in to comment.