Skip to content

Commit

Permalink
Support/require specifying a metabase version for the docker image
Browse files Browse the repository at this point in the history
It can be retrieved by running e.g.

    docker inspect -f '{{index .Config.Labels "io.materialize.metabase-version"}}' materialize/metabase:latest

Which is I guess something.
  • Loading branch information
quodlibetor committed Feb 13, 2020
1 parent b7baaec commit 58a03b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM metabase/metabase:latest
ARG METABASE_VERSION=latest
FROM metabase/metabase:${METABASE_VERSION}

ARG METABASE_VERSION
LABEL io.materialize.metabase-version=${METABASE_VERSION}

ADD target/dist/materialize-driver.jar /plugins/
RUN chmod 744 /plugins/materialize-driver.jar
17 changes: 16 additions & 1 deletion bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
set -euo pipefail

usage() {
echo "usage: $0 [--release [VERSION]] [--build]
echo "usage: $0 [--release [VERSION]] [--mbv VERSION] [--build]
Build a docker image.
Options:
--release Pull from the current tagged release in github
--release VERSION Pull VERSION from the tagged release in github
--mbv VERSION Specify a metabase version, default is latest. Required for --release
--build Build the jar and create a docker image from using that
--no-docker Don't run docker build"

Expand All @@ -25,6 +26,7 @@ NOW="$(date +%Y%m%d_%H%M%S)"
# options
RELEASE=n
VERSION=_
METABASE_VERSION=latest
BUILD=n
DOCKER=y

Expand All @@ -40,6 +42,7 @@ main() {
-t materialize/metabase:"$NOW" \
-t materialize/metabase:"$VERSION" \
-t materialize/metabase:latest \
--build-arg METABASE_VERSION="$METABASE_VERSION" \
.
fi
}
Expand All @@ -55,6 +58,13 @@ parse_args() {
VERSION="$1" && shift
fi
;;
--mbv)
if [[ $# -eq 0 ]]; then
echo "--mbv requires a VERSION"
usage 1
fi
METABASE_VERSION="$1" && shift
;;
--build)
BUILD=y
;;
Expand All @@ -72,6 +82,11 @@ parse_args() {
done
if [[ $RELEASE == y && $BUILD == y ]]; then
echo "error: --release and --build don't make sense together"
exit 1
fi
if [[ $RELEASE == y && $METABASE_VERSION == latest ]]; then
echo "error: --mbv is required for --release"
exit 1
fi
}

Expand Down

0 comments on commit 58a03b4

Please sign in to comment.