Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --tag arg to docker/up.sh #1413

Merged
merged 4 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.seed.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
seed_marquez:
image: marquezproject/marquez:latest
image: "marquezproject/marquez:${TAG}"
environment:
- MARQUEZ_HOST=api
- MARQUEZ_PORT=5000
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
api:
image: marquezproject/marquez:latest
image: "marquezproject/marquez:${TAG}"
ports:
- "5000:5000"
- "5001:5001"
Expand All @@ -14,7 +14,7 @@ services:
entrypoint: ["./wait-for-it.sh", "db:5432", "--", "./entrypoint.sh"]

web:
image: marquezproject/marquez-web:latest
image: "marquezproject/marquez-web:${TAG}"
environment:
- MARQUEZ_HOST=api
- MARQUEZ_PORT=5000
Expand Down
38 changes: 30 additions & 8 deletions docker/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Usage: $ ./up.sh [--build | --pull] [--seed]
# Usage: $ ./up.sh [--tag TAG] [--build] [--seed]

set -e

usage() {
echo "usage: ./$(basename -- ${0}) [--build | --pull] [--seed]"
echo "usage: ./$(basename -- ${0}) [--tag TAG] [--build] [--seed]"
echo
echo "A script used to run Marquez via Docker"
echo
echo "Examples:"
echo " # Build image from source"
echo " $ ./up.sh --build"
echo
echo " # Build image from source, then seed HTTP server with metadata"
echo " $ ./up.sh --build --seed"
echo
echo " # Build tagged image"
echo " ./up.sh --tag X.Y.X"
echo
echo " # Build tagged image, then seed HTTP server with metadata"
echo " ./up.sh --tag X.Y.X --seed"
echo
echo
echo "Arguments:"
echo " -t, --tag string image tag (default: latest)"
echo " -b, --build build image from source"
echo " -s, --seed seed HTTP server with metadata"
echo " -h, --help show help for script"
exit 1
}

Expand All @@ -28,14 +50,16 @@ cd "${project_root}"
compose_files="-f docker-compose.yml"
args="-V --force-recreate"

TAG="latest"
while [ $# -gt 0 ]; do
case $1 in
'--tag'|-t)
shift
TAG="${1}"
;;
'--build'|-b)
BUILD='true'
;;
'--pull'|-p)
PULL='true'
;;
'--seed'|-s)
SEED='true'
;;
Expand All @@ -53,12 +77,10 @@ done
if [[ "${BUILD}" = "true" ]]; then
compose_files+=" -f docker-compose.dev.yml"
args+=" --build"
elif [[ "${PULL}" = "true" ]]; then
docker-compose pull
fi

if [[ "${SEED}" = "true" ]]; then
compose_files+=" -f docker-compose.seed.yml"
fi

docker-compose $compose_files up $args
TAG=${TAG} docker-compose $compose_files up $args