Reputation: 11919
I have the following Dockerfile:
FROM maven:3.3.9
COPY . /code
WORKDIR /code
RUN ["mvn", "install"]
CMD mvn spring-boot:run
Which crashes on line 4 (mvn install
), because all packages are installed, but at the end Spring starts and attempts to connect to the database container (it is not running, because for now I'm only building the images).
Is there a way I can just install maven packages, without getting spring up and running? I want to avoid downloading a lot of things every time I start my backend service.
Upvotes: 1
Views: 1296
Reputation: 537
Do mvn install -DskipTests
. It will skip everything and just download packages
Upvotes: 1
Reputation: 1014
CMD mvn spring-boot:run
will cause application to start. Just replace it with a CMD sh -c
or something that fits your need.
The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well.
https://docs.docker.com/engine/reference/builder/
Upvotes: 0