Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mariano Gappa
committed
Feb 24, 2016
1 parent
4ae98a8
commit 7573087
Showing
7 changed files
with
121 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM jeanblanchard/java:8 | ||
|
||
RUN mkdir -p /lib | ||
|
||
WORKDIR / | ||
|
||
ADD /target/pack/lib /lib | ||
ADD /target/pack/ostinato.jar /lib/ | ||
ADD /target/pack/bin/main /ostinato | ||
|
||
EXPOSE 51234 | ||
|
||
ENTRYPOINT ["/ostinato"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
PROJECT_VERSION=$(./version.sh) | ||
PROJECT_SCALA_VERSION=$(./scalaMajorVersion.sh) | ||
|
||
NAME="ostinato" | ||
ZIP_NAME="${NAME}-${PROJECT_VERSION}" | ||
ZIP_PATH="target/${ZIP_NAME}" | ||
|
||
# Docker image name and tag | ||
IMAGE_NAME=$1 | ||
TAG=$2 | ||
|
||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd $SCRIPT_DIR | ||
|
||
if [ -z "$IMAGE_NAME" ] ; then | ||
cat << 'EOF' | ||
Usage: ./docker-build.sh <image-name> <tag> | ||
e.g.: ./docker-build.sh ostinato-server test | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -f "${ZIP_PATH}.zip" ]]; then | ||
echo >&2 "Please run 'sbt packArchiveZip' first." | ||
exit 1 | ||
fi | ||
|
||
find $SCRIPT_DIR -name "${ZIP_NAME}.zip" -exec unzip -o {} -d target/ \; | ||
mkdir -p target/pack/lib | ||
mv -f -v target/${ZIP_NAME}/lib/* "target/pack/lib" | ||
|
||
#TODO remove sjs files | ||
rm target/pack/lib/*_sjs*.jar | ||
|
||
echo "Moving $IMAGE_NAME jar out of lib folder so that there are less changes to be added to the docker image" | ||
mv target/pack/lib/$NAME*.jar target/pack/$NAME.jar | ||
|
||
|
||
echo "Creating the docker image ${IMAGE_NAME}:${TAG}" | ||
docker build --quiet=false -t $IMAGE_NAME:$TAG . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Echoes the build.sbt project scala major version to STDOUT. | ||
# e.g. Major version of 2.11.7 is 2.11 | ||
# | ||
# NOTES: | ||
# - place this script on the root of your project | ||
# - this script should then find a build.sbt inside your project | ||
# - this script assumes your project version setting is a literal e.g.: `version := "0.1-SNAPSHOT"` | ||
|
||
# Exit on unset variables or if any of the following commands returns non-zero | ||
set -eu | ||
|
||
# cd to path of current script | ||
# (based on http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in) | ||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd $SCRIPT_DIR | ||
|
||
# Find the first build.sbt in the path tree of this script, | ||
# find the version line and extract the content within double quotes | ||
find '.' -name "build.sbt" | | ||
head -n1 | | ||
xargs grep '[ \t]*scalaVersion :=' | | ||
head -n1 | | ||
sed 's/.*"\(.*\)".*/\1/' | | ||
sed 's/^\([0-9]*\.[0-9]*\)\.[0-9]*$/\1/' |
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,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Echoes the build.sbt project version to STDOUT. | ||
# | ||
# NOTES: | ||
# - place this script on the root of your project | ||
# - this script should then find a build.sbt inside your project | ||
# - this script assumes your project version setting is a literal e.g.: `version := "0.1-SNAPSHOT"` | ||
|
||
# Exit on unset variables or if any of the following commands returns non-zero | ||
set -eu | ||
|
||
# cd to path of current script | ||
# (based on http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in) | ||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd $SCRIPT_DIR | ||
|
||
# Find the first build.sbt in the path tree of this script, | ||
# find the version line and extract the content within double quotes | ||
find '.' -name "build.sbt" | | ||
head -n1 | | ||
xargs grep '[ \t]*version :=' | | ||
head -n1 | | ||
sed 's/.*"\(.*\)".*/\1/' | ||
|
||
# check for updates to this script at https://gist.github.com/MarianoGappa/265876f9e69505b4635e |