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

Fix docker/up.sh to allow for multiple flags #844

Merged
merged 2 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
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