Small question regarding migrating building Docker images from Dockerfile to BuildPacks for a SpringBoot project.
I have a very straightforward SpringBoot application I need to containerize. In order to do so, I have a very straightforward Dockerfile:
FROM my-custom-java-base-image
RUN install -d -o some-user -g some-user /var/log/supervisor
RUN chmod -R 755 /usr/local/some-user/
EXPOSE 9999
Please note, in this Dockerfile, there is a custom java base image, the need to run some RUN commands (as well as running some other commands), and exposing a custom port, not the usual 8080.
This image builds fine, and everything works with it, very happy.
Now, since SpringBoot 2.3, there is this new feature with Buildpacks integration, where one can just simply run ./mvnw spring-boot:build-image
and have a very nice layered Docker image built.
This Layered Docker image is indeed very cool. Many talks at popular conferences shows the benefits of this new way of building images:
references:
https://www.youtube.com/watch?v=44n_MtsggnI
https://www.youtube.com/watch?v=EVHHyiypiY0
However, during all the demo I could find online, the initial Dockerfile is very rudimentary, no custom port, no custom commands, as if it can only work for the basic
FROM alpine
WORKDIR /tmp
COPY target/myapp.jar myapp.jar
ENTRYPOINT [java -jar blablabla]
What I tried so far is to find in the plugin configuration a way to configure the things I need from my Dockerfile
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- Configuration to push the image to our own Dockerhub repository-->
<configuration>
<image>
<name>docker.io/2013techsmarts/${project.artifactId}:latest</name>
</image>
some configuration for the port, some commands to run, etc
</configuration>
</plugin>
</plugins>
</build>
But no luck.
Is this new way of building images everyone is talking about good only for very basic Dockerfile?
How may I change the port, the base image, add my own commands etc while using Buildpacks please?
Thank you