-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from docksal/develop
Release 1.5.0
- Loading branch information
Showing
10 changed files
with
128 additions
and
60 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
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 was deleted.
Oops, something went wrong.
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 @@ | ||
docker_process_init_files /var/www/.docksal/services/db/* |
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,7 @@ | ||
|
||
# Process pre init scripts run by root | ||
for f in /docker-entrypoint.d/*.sh; do | ||
echo "Running init scripts in /docker-entrypoint.d/ as root..." | ||
. "$f" | ||
done | ||
|
This file was deleted.
Oops, something went wrong.
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,87 @@ | ||
#!/usr/bin/env bash | ||
|
||
# ----- Helper functions ----- # | ||
|
||
is_edge () | ||
{ | ||
[[ "${TRAVIS_BRANCH}" == "develop" ]] | ||
} | ||
|
||
is_stable () | ||
{ | ||
[[ "${TRAVIS_BRANCH}" == "master" ]] | ||
} | ||
|
||
is_release () | ||
{ | ||
[[ "${TRAVIS_TAG}" != "" ]] | ||
} | ||
|
||
# Check whether the current build is for a pull request | ||
is_pr () | ||
{ | ||
[[ "${TRAVIS_PULL_REQUEST}" != "false" ]] | ||
} | ||
|
||
is_latest () | ||
{ | ||
[[ "${VERSION}" == "${LATEST_VERSION}" ]] | ||
} | ||
|
||
# Tag and push an image | ||
# $1 - source image | ||
# $2 - target image | ||
tag_and_push () | ||
{ | ||
local source=$1 | ||
local target=$2 | ||
|
||
# Base image | ||
echo "Pushing ${target} image ..." | ||
docker tag ${source} ${target} | ||
docker push ${target} | ||
} | ||
|
||
# ---------------------------- # | ||
|
||
# Extract version parts from release tag | ||
IFS='.' read -a ver_arr <<< "$TRAVIS_TAG" | ||
VERSION_MAJOR=${ver_arr[0]#v*} # 2.7.0 => "2" | ||
VERSION_MINOR=${ver_arr[1]} # "2.7.0" => "7" | ||
|
||
# Set tags if exists | ||
SOFTWARE_VERSION="${SOFTWARE_VERSION:+${SOFTWARE_VERSION}-}" | ||
|
||
# Possible docker image tags | ||
# "image:tag" pattern: <image-repo>:<software-version>[-<image-stability-tag>][-<flavor>] | ||
IMAGE_TAG_EDGE="${SOFTWARE_VERSION}edge" # e.g., [SOFTWARE_VERSION-]edge | ||
IMAGE_TAG_STABLE="${SOFTWARE_VERSION}stable" # e.g., [SOFTWARE_VERSION-]stable | ||
IMAGE_TAG_RELEASE_MAJOR="${SOFTWARE_VERSION}${VERSION_MAJOR}" # e.g., [SOFTWARE_VERSION-]2 | ||
IMAGE_TAG_RELEASE_MAJOR_MINOR="${SOFTWARE_VERSION}${VERSION_MAJOR}.${VERSION_MINOR}" # e.g., [SOFTWARE_VERSION-]2.7 | ||
IMAGE_TAG_LATEST="latest" | ||
|
||
# Skip pull request builds | ||
is_pr && exit | ||
|
||
docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" | ||
|
||
# Push images | ||
if is_edge; then | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_EDGE} | ||
elif is_stable; then | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} | ||
elif is_release; then | ||
# Have stable, major, minor tags match | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} | ||
else | ||
# Exit if not on develop, master or release tag | ||
exit | ||
fi | ||
|
||
# Special case for the "latest" tag | ||
# Push (base image only) on stable and release builds | ||
if is_latest && (is_stable || is_release); then | ||
tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_LATEST} | ||
fi |
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