Skip to content

Commit

Permalink
(maint) auto configure lein local-repo for caching between builds
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Apr 29, 2024
1 parent cc3ae2a commit 15a07f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ This container assumes that the code you're building will be in `/workspace`. Th
will be copied into `/output` before the container terminates, and if you're building a
custom ezbake that will be cloned into `/ezbake`.

If `/repo` is volume mapped, lein will automatically be configured to it as the local-repo.
Useful for saving the maven repository cache between builds.

1. Run from a remotely accessible repo (github, gitlab, etc)

This is by far the fastest build option, but does require the extra step of committing and pushing your code
Expand Down
8 changes: 8 additions & 0 deletions docker/ezbake/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ source /.docker_build_args

echo "Ezbake docker image $version, build $build_date, ref $vcs_ref, source $source_url"

# setup maven repository cache
if [ -d /repo ] ; then
cp -na /root/.m2/repository/* /repo/
rm -rf /root/.m2/repository
ln -s /repo /root/.m2/repository
echo '{:user {:local-repo "/repo"}}' > /root/.lein/profiles.clj
fi

if [ -n "$EZBAKE_REPO" ]; then
echo "cloning $EZBAKE_REPO"
git clone $EZBAKE_REPO /ezbake
Expand Down

0 comments on commit 15a07f4

Please sign in to comment.