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
1 parent
c7da59c
commit fc47b81
Showing
5 changed files
with
47 additions
and
16 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
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,11 @@ | ||
FROM openjdk:8-jdk | ||
|
||
MAINTAINER Pete Cornish <outofcoffee@gmail.com> | ||
|
||
RUN mkdir -p /opt/corebot /opt/corebot/config | ||
|
||
ADD build/install/slack-items /opt/corebot | ||
|
||
WORKDIR "/opt/corebot" | ||
|
||
ENTRYPOINT [ "./bin/slack-items" ] |
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 |
---|---|---|
@@ -1,36 +1,56 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
DOCKERFILE_PATH="${SCRIPT_DIR}/../bots/slack-" | ||
IMAGE_BASE_NAME="outofcoffee/corebot" | ||
IMAGE_TAG="${1-dev}" | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
IMAGES=( | ||
"deploy" | ||
"items" | ||
) | ||
|
||
function buildImage() | ||
{ | ||
IMAGE_NAME="${IMAGE_BASE_NAME}:${IMAGE_TAG}" | ||
echo -e "\nBuilding Docker image: ${IMAGE_NAME}" | ||
IMAGE_SUFFIX="$2" | ||
IMAGE_NAME="${IMAGE_BASE_NAME}${IMAGE_SUFFIX}:${IMAGE_TAG}" | ||
|
||
echo -e "\nBuilding Docker image: ${IMAGE_NAME}" | ||
cd $1 | ||
docker build --tag ${IMAGE_NAME} . | ||
} | ||
|
||
|
||
function pushImage() | ||
{ | ||
IMAGE_SUFFIX="$1" | ||
IMAGE_NAME="${IMAGE_BASE_NAME}${IMAGE_SUFFIX}:${IMAGE_TAG}" | ||
|
||
echo -e "\nLogging in to Docker registry..." | ||
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" --email deprecated@example.com | ||
|
||
IMAGE_NAME="${IMAGE_BASE_NAME}:${IMAGE_TAG}" | ||
echo -e "\nPushing Docker image: ${IMAGE_NAME}" | ||
|
||
docker push ${IMAGE_NAME} | ||
} | ||
|
||
echo -e "\nBuilding image from local source" | ||
buildImage "${SCRIPT_DIR}/../" | ||
function buildPushImage() | ||
{ | ||
IMAGE_DIR="$1" | ||
echo -e "\nBuilding '${IMAGE_DIR}' image" | ||
|
||
if [[ "deploy" == "${IMAGE_DIR}" ]]; then | ||
IMAGE_SUFFIX="" | ||
else | ||
IMAGE_SUFFIX="-${IMAGE_DIR}" | ||
fi | ||
buildImage "${DOCKERFILE_PATH}${IMAGE_DIR}" ${IMAGE_SUFFIX} | ||
|
||
if [[ "dev" == "${IMAGE_TAG}" ]]; then | ||
echo -e "\nSkipped pushing dev image" | ||
else | ||
pushImage ${IMAGE_SUFFIX} | ||
fi | ||
} | ||
|
||
if [[ "dev" == "${IMAGE_TAG}" ]]; then | ||
echo -e "\nSkipped pushing dev image" | ||
else | ||
pushImage | ||
fi | ||
for IMAGE_DIR in "${IMAGES[@]}"; do | ||
buildPushImage ${IMAGE_DIR} | ||
done |