-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #106 generate build.sh for easy docker build with version
- Loading branch information
Showing
11 changed files
with
174 additions
and
19 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
52 changes: 52 additions & 0 deletions
52
light-graphql-4j/src/main/resources/templates/graphql/buildSh.rocker.raw
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,52 @@ | ||
@args (String org, String serviceId) | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
VERSION=$1 | ||
IMAGE_NAME="@org/@serviceId" | ||
|
||
showHelp() { | ||
echo " " | ||
echo "Error: $1" | ||
echo " " | ||
echo " build.sh [VERSION]" | ||
echo " " | ||
echo " where [VERSION] version of the docker image that you want to publish (example: 0.0.1)" | ||
echo " " | ||
echo " example: ./build.sh 0.0.1" | ||
echo " " | ||
} | ||
|
||
build() { | ||
echo "Building ..." | ||
mvn clean install | ||
echo "Successfully built!" | ||
} | ||
|
||
cleanup() { | ||
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" != "" ]]; then | ||
echo "Removing old $IMAGE_NAME images" | ||
docker images | grep $IMAGE_NAME | awk '{print $3}' | xargs docker rmi -f | ||
echo "Cleanup completed!" | ||
fi | ||
} | ||
|
||
publish() { | ||
echo "Building Docker image with version $VERSION" | ||
docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true | ||
docker build -t $IMAGE_NAME:$VERSION-redhat -f ./docker/Dockerfile-Redhat . --no-cache=true | ||
echo "Images built with version $VERSION" | ||
echo "Pushing image to DockerHub" | ||
docker push $IMAGE_NAME | ||
echo "Image successfully published!" | ||
} | ||
|
||
if [ -z $VERSION ]; then | ||
showHelp "[VERSION] parameter is missing" | ||
exit | ||
fi | ||
|
||
build; | ||
cleanup; | ||
publish; |
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
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
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
52 changes: 52 additions & 0 deletions
52
light-hybrid-4j/src/main/resources/templates/hybrid/server/buildSh.rocker.raw
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,52 @@ | ||
@args (String org, String serviceId) | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
VERSION=$1 | ||
IMAGE_NAME="@org/@serviceId" | ||
|
||
showHelp() { | ||
echo " " | ||
echo "Error: $1" | ||
echo " " | ||
echo " build.sh [VERSION]" | ||
echo " " | ||
echo " where [VERSION] version of the docker image that you want to publish (example: 0.0.1)" | ||
echo " " | ||
echo " example: ./build.sh 0.0.1" | ||
echo " " | ||
} | ||
|
||
build() { | ||
echo "Building ..." | ||
mvn clean install | ||
echo "Successfully built!" | ||
} | ||
|
||
cleanup() { | ||
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" != "" ]]; then | ||
echo "Removing old $IMAGE_NAME images" | ||
docker images | grep $IMAGE_NAME | awk '{print $3}' | xargs docker rmi -f | ||
echo "Cleanup completed!" | ||
fi | ||
} | ||
|
||
publish() { | ||
echo "Building Docker image with version $VERSION" | ||
docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true | ||
docker build -t $IMAGE_NAME:$VERSION-redhat -f ./docker/Dockerfile-Redhat . --no-cache=true | ||
echo "Images built with version $VERSION" | ||
echo "Pushing image to DockerHub" | ||
docker push $IMAGE_NAME | ||
echo "Image successfully published!" | ||
} | ||
|
||
if [ -z $VERSION ]; then | ||
showHelp "[VERSION] parameter is missing" | ||
exit | ||
fi | ||
|
||
build; | ||
cleanup; | ||
publish; |
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
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
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
52 changes: 52 additions & 0 deletions
52
light-rest-4j/src/main/resources/templates/rest/buildSh.rocker.raw
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,52 @@ | ||
@args (String org, String serviceId) | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
VERSION=$1 | ||
IMAGE_NAME="@org/@serviceId" | ||
|
||
showHelp() { | ||
echo " " | ||
echo "Error: $1" | ||
echo " " | ||
echo " build.sh [VERSION]" | ||
echo " " | ||
echo " where [VERSION] version of the docker image that you want to publish (example: 0.0.1)" | ||
echo " " | ||
echo " example: ./build.sh 0.0.1" | ||
echo " " | ||
} | ||
|
||
build() { | ||
echo "Building ..." | ||
mvn clean install | ||
echo "Successfully built!" | ||
} | ||
|
||
cleanup() { | ||
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" != "" ]]; then | ||
echo "Removing old $IMAGE_NAME images" | ||
docker images | grep $IMAGE_NAME | awk '{print $3}' | xargs docker rmi -f | ||
echo "Cleanup completed!" | ||
fi | ||
} | ||
|
||
publish() { | ||
echo "Building Docker image with version $VERSION" | ||
docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true | ||
docker build -t $IMAGE_NAME:$VERSION-redhat -f ./docker/Dockerfile-Redhat . --no-cache=true | ||
echo "Images built with version $VERSION" | ||
echo "Pushing image to DockerHub" | ||
docker push $IMAGE_NAME | ||
echo "Image successfully published!" | ||
} | ||
|
||
if [ -z $VERSION ]; then | ||
showHelp "[VERSION] parameter is missing" | ||
exit | ||
fi | ||
|
||
build; | ||
cleanup; | ||
publish; |
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