#!/bin/bash base_repo=registry.cn-beijing.aliyuncs.com/touka/sandc app_name=$1 version=$2 if [ -z $app_name ]; then read -p "Enter app name: " app_name read -p "Enter app version: " version fi if [ -z $app_name ]; then echo "app name is empty, exit" exit 1 fi if [ ! -d "app/$app_name" ]; then echo "app directory is not exists, exit" exit 1 fi if [ -z $version ]; then version=`date '+%y%m%d-%H%M'` fi #docker build -t $app_name:$version --build-arg APP_RELATIVE_PATH=$app_name . repo=$base_repo:$app_name-$version docker build -t $repo -f app/$app_name/manifests/Dockerfile . echo "$repo build success!" read -p "push remote registry?[yes/no]: " remote if [[ $(echo $remote | awk '{print tolower($1)}') == "yes" ]]; then docker push $repo fi