Skip to content

Commit

Permalink
Simplified.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Nov 17, 2024
1 parent 774078b commit abc6fc1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/kaniko-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package_docker() {

package_all_docker() {
if [ ! -z "$OS_APPLICATIONS" ] ; then
for app_dir in $(echo $OS_APPLICATIONS | sed "s/,/ /g"); do
for app_dir in ${OS_APPLICATIONS//,/ }; do
package_docker $app_dir
done
echo Finished packaging $OS_APPLICATIONS
Expand All @@ -30,7 +30,8 @@ package_all_docker() {
package_docker .
else
echo "No Dockerfile and no OS_APPLICATIONS variable found"
OS_APPLICATIONS=$(find . -maxdepth 2 -mindepth 2 -name "Dockerfile" -exec sh -c 'f=$(dirname $1); basename $f;' shell {} \; | tr '\n' ',' | sed 's/,$//')
# We assume that we have to build all Dockerfiles in subdirectories, that have 'ARG NAME'
OS_APPLICATIONS=$(find . -maxdepth 2 -mindepth 2 -name "Dockerfile" -exec sh -c 'f=$(dirname $(grep -l -i -E "ARG\s+NAME" $1)); basename $f;' shell {} \; | tr '\n' ',' | sed 's/,$//')
if [ ! -z "$OS_APPLICATIONS" ] ; then
echo "Guessed OS_APPLICATIONS=$OS_APPLICATIONS"
package_all_docker
Expand Down

0 comments on commit abc6fc1

Please sign in to comment.