Skip to content

Commit

Permalink
Feat: Allow for local build single container
Browse files Browse the repository at this point in the history
Usage example: "bash cicd/docker-build-local.sh ubi9".
  • Loading branch information
clemlesne committed Nov 21, 2023
1 parent 572f04e commit 264e240
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions cicd/docker-build-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@ FOLDER="src/docker"
PREFIX="${FOLDER}/Dockerfile-"

# Initialize the SUFFIXES variable
SUFFIXES=""
SUFFIXES="$1"

# Check if docker is installed
if ! command -v docker &> /dev/null; then
echo "Docker is not installed, please install it to proceed."
exit
fi

# Iterate over files with the pattern "Dockerfile-*"
for file in $PREFIX*; do
# Extract the suffix from the file name
suffix="${file#$PREFIX}"
# Append the suffix to the SUFFIXES variable
SUFFIXES="${SUFFIXES} ${suffix}"
done
# Check if the SUFFIXES variable is empty
if [ -z "$SUFFIXES" ]; then
echo "No suffixes provided, building all Docker images."

# Iterate over files with the pattern "Dockerfile-*"
for file in $PREFIX*; do
# Extract the suffix from the file name
suffix="${file#$PREFIX}"
# Append the suffix to the SUFFIXES variable
SUFFIXES="${SUFFIXES} ${suffix}"
done
fi

# Print the SUFFIXES variable
echo "Matrix:${SUFFIXES}"
Expand Down

0 comments on commit 264e240

Please sign in to comment.