Docker: In Dockerfile, copy files temporarily, but not for final image -


I have a Java service that I would like to package, and the only thing that is the jar file of the last dock image is Config file However, first of all, I need to run my gradle command to create JAR, but I should not do that the gradle result uses the Docker image.

Here is my current Dockerfile:

  Get the update exactly & amp; Apt-get install -y openjdk-7-jdk Copy / run ./gradlew shadowJar CMD ["java", "-zer", "service / build / lbs / service.jar", "server", "service / service .imil "]   

You can see that I have to do the copy first so that I can . / Gradlew (otherwise it says that the command can not be found). But in the end, I only need all the service.jar and service.yml files.

I'm probably missing something, but how do I . / Gradlew can provide everything during the build phase, but only the result image includes service.jar and service.yml .

An image creation is as follows:

... Docker The build command will use the docfiler as the directory that is in the form of a build contact (including all its subdirectories). The build context will be sent to the Doker Damon before creating the image, which means that if you use the source repository, the entire contents of your hard drive will be sent to the daemon ... < P> See

There is no way to achieve what I want you to do. There are two options:

  1. To maintain all the build dependency inside the image and blot your image to create your JR file inside the container.

  2. I advise to make my jar separately and when they are created, simply executable and config file ADD means that all Build dependencies should be available on your development environment, but your image is as small as it can be.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -