Skip to content

Commit

Permalink
Update cache location and try to use docker mount cache as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
dacort committed Feb 2, 2022
1 parent d188429 commit e1c5198
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Maven cache
uses: actions/cache@v1
with:
path: /root/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-
-
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ COPY resources/ ./resources
# We need to build java deps and then spark-sql deps
# Ref: https://github.com/metabase/metabase/wiki/Migrating-from-Leiningen-to-tools.deps#preparing-dependencies
WORKDIR /build/metabase
RUN clojure -X:deps prep
RUN --mount=type=cache,target=/root/.m2/repository \
clojure -X:deps prep

WORKDIR /build/metabase/modules/drivers
RUN clojure -X:deps prep
RUN --mount=type=cache,target=/root/.m2/repository \
clojure -X:deps prep
WORKDIR /build/driver

# Test stage
Expand All @@ -52,14 +55,15 @@ CMD ["clojure", "-X:test"]

# Now build the driver
FROM stg_base as stg_build
RUN clojure -X:dev:build
RUN --mount=type=cache,target=/root/.m2/repository \
clojure -X:dev:build

# We create an export stage to make it easy to export the driver
FROM scratch as stg_export
COPY --from=stg_build /build/driver/target/athena.metabase-driver.jar /

# Now we can run Metabase with our built driver
FROM metabase/metabase:${METABASE_VERSION}
FROM metabase/metabase:${METABASE_VERSION} AS stg_runner

# A metabase user/group is manually added in https://github.com/metabase/metabase/blob/master/bin/docker/run_metabase.sh
# Make the UID and GID match
Expand Down

0 comments on commit e1c5198

Please sign in to comment.