Fork me on GitHub
#leiningen
<
2018-04-13
>
callum03:04:32

Is there a way to install dependencies globally (non-user-specific)?

danielcompton03:04:23

@callum what are you trying to achieve by doing that?

danielcompton03:04:34

Leiningen has the concept of user profiles

danielcompton03:04:44

but it's not quite the same as npm i -g

danielcompton03:04:09

because the dependencies are always* used in the context of a project

danielcompton03:04:20

* you can run a REPL outside of a project, but it's not quite the same

danielcompton03:04:00

If you add plugins to your lein profiles.clj (https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md) then you can run them from anywhere on the system

callum03:04:45

@danielcompton slightly weird situation… we have a clojure docker image being built which installs leiningen as part of its build. Then an application image which builds on top of the clojure image and pulls down the dependencies. All of this happens under the root user and the application itself is eventually run under an application user, it would be great if the dependencies could be available for all users

danielcompton03:04:44

Is your application run as an uberjar?

callum03:04:56

not in this particular instance, no

danielcompton03:04:35

I would probably set my local repo to be a shared location that both users can read/write to

gklijs07:04:34

@callum more a thing for #docker but once you start pulling in dependencies inside dockers it makes a lot of sense to use a volume for your maven repo, preventing needing to download it multiple times.

callum07:04:55

yeah, weird situation caused by a legacy docker setup at the org i’m at

callum07:04:22

it’s looking more and more like we’ll have to spend the time to move away from the docker containers we’ve been provided with

callum07:04:56

@gklijs yeah, that works well for a local dev situation but when it comes to running our app in CI (for tests etc.), we generally pull the deps down during a docker image build and then push that image to a docker repo. we then pull that image down when running docker in CI

callum07:04:27

we generally just rebuild that image when our dependencies get updated

gklijs07:04:54

For CI I would rather build a production-like image based on an uberjar

callum07:04:33

production uberjars aren’t going to have tests packaged within them

gklijs07:04:19

Sorry, thought you mend other kinds of test, but you can use a shared volume on you CI right? I recently was at a meetup and they used google docker builder that way. Since you get a clean vm with docker to do stuff, it’s nice not having to download dependencies each time.

callum07:04:31

hmm, not sure what you mean sorry

callum07:04:50

where would the dependencies live when you’re running the tests in CI with a shared volume?