Fork me on GitHub
#docker
<
2021-01-20
>
mathpunk19:01:58

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?

tvaughan20:01:36

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