Skip to content

Commit

Permalink
Fix docker/up.sh to allow for multiple flags
Browse files Browse the repository at this point in the history
Signed-off-by: wslulciuc <[email protected]>
  • Loading branch information
wslulciuc committed Nov 19, 2020
1 parent 7f5a96d commit 1faf782
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ version: "3.7"
services:
app:
build: .

web:
build:
context: ./web
dockerfile: Dockerfile
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ services:
entrypoint: ["./wait-for-it.sh", "db:5432", "--", "./entrypoint.sh"]

web:
build:
context: ./web
dockerfile: Dockerfile
image: marquezproject/marquez-web:latest
environment:
- MARQUEZ_HOST=app
- MARQUEZ_PORT=5000
Expand Down
25 changes: 17 additions & 8 deletions docker/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Usage: $ ./up.sh [--build]
# Usage: $ ./up.sh [--build] [--seed]

set -e

usage() {
echo "usage: ./$(basename -- ${0}) [--build] [--seed]"
exit 1
}

# Change working directory to project root
project_root=$(git rev-parse --show-toplevel)
cd "${project_root}"
Expand All @@ -27,24 +32,28 @@ while [ $# -gt 0 ]; do
case $1 in
'--build'|-b)
BUILD='true'
break
;;
'--seed'|-s)
SEED='true'
;;
*) exit 1
'--help'|-h)
usage
exit 0
;;
*) usage
exit 1
;;
esac
shift
done

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

if [[ "${BUILD}" = "true" ]]; then
compose_files+=" -f docker-compose.dev.yml"
args+=" --build"
fi

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

docker-compose $compose_files up $args

0 comments on commit 1faf782

Please sign in to comment.