docker

mathpunk 2021-01-20T19:18:58.003400Z

I'm writing my first Dockerfile.

FROM clojure
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY deps.edn /usr/src/app/
RUN clojure -P
COPY . /usr/src/app
CMD ["clojure", "-M:terminal-report"]
I believe that the RUN lines happen on build, so that the build will have the deps downloaded, and that the CMD runs during docker run. Have I got that right?

mathpunk 2021-01-21T23:29:32.000100Z

thank you

lukasz 2021-01-20T19:29:09.003600Z

yes

1
tvaughan 2021-01-20T20:10:36.006700Z

Yes, as someone already answered. You can also omit RUN clojure -P and mount a volume under /root/.m2 to cache the dependencies between runs. The tradeoff is a smaller image size for a longer initial startup time