Skip to content

Commit

Permalink
Made it less warry.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Nov 17, 2024
1 parent e6afe81 commit 774078b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
= npo-poms/kaniko

`gcr.io/kaniko-project/executor:debug` with some extra scripts that are use in our pipeline. It's better to have the scripts in an image, which is used in a pipeline than having the scripts themselves encapsulated in a yaml.
`gcr.io/kaniko-project/executor:debug` with some extra scripts that are use in our pipelines. It's better to have the scripts in an image, which is used in a pipeline than having the scripts themselves encapsulated in a yaml.

== features

The scripts are mainly targeted at maven projects
The entrypoint of the image is `/script.sh`. This will look for
- a Dockerfile in the current directory
- or if not present in Dockerfiles in subdirectories (non-recursively).
- every Dockerfile is build and pushed to the registry (default registry.npohosting.nl)
The name of the artifact can be influenced by environment variables, but on default
it is based on the ARG NAME in the Dockerfile itself.

- that produce wars
- multimodule, a project running this in can even product multiple wars.
- a module producing a war, must contain a Dockerfile with a ARG NAME=<name>
which will be used to generate the image name
- the resulting images are default pushed to registry.npohosting.nl
We mainly use this in maven-projects. Which might have 1 or more submodules that produce wars that are encapsulated in a docker-image with tomcat.



Expand Down
5 changes: 2 additions & 3 deletions scripts/kaniko-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ package_all_docker() {
echo "Packaging the root directory only"
package_docker .
else

echo "No Dockerfile and no OS_APPLICATIONS variable found"
OS_APPLICATIONS=$(find . -maxdepth 3 -mindepth 3 -name "*${PROJECT_VERSION}.war" -exec sh -c 'f=$(dirname $1); (cd $f/..; basename $PWD) ;' shell {} \; | tr '\n' ',' | sed 's/,$//')
OS_APPLICATIONS=$(find . -maxdepth 2 -mindepth 2 -name "Dockerfile" -exec sh -c 'f=$(dirname $1); basename $f;' shell {} \; | tr '\n' ',' | sed 's/,$//')
if [ ! -z "$OS_APPLICATIONS" ] ; then
echo "Guessed OS_APPLICATIONS=$OS_APPLICATIONS"
package_wars
package_all_docker
else
echo "Could not guess either for ${PROJECT_VERSION}"
fi
Expand Down

0 comments on commit 774078b

Please sign in to comment.