Specifying external Dockerfile broken
See original GitHub issueDescription
Specifying an external dockerfile for springboot based project doesn’t work as expected and as mentioned in the documentation.
-
Placing the
Dockerfile
in default location i.e.src/main/docker
, doesn’t have any effect on the build and fmp continues to use the default dockerfile instead of the external one. By specifying thedockerFileDir
as./
, fmp was able to read the dockerfile../
refers to the exact same locationsrc/main/docker
which should have been set by default. -
As mentioned in the documentation, the default location for assembly is
maven/
, but copying from this location in the dockerfile fails with the errorNo such file or directory found
. Where as the default dockerfile used by fmp copy’s from the same locationmaven/
and does not fail.
Info
- f-m-p version : 3.5.31
- Maven version (
mvn -v
) : 3.3.9 - Kubernetes / OpenShift setup and version : Kubernetes v1.7.8
Steps to reproduce:
- Create a
Dockerfile
identical to the one fmp uses by default, just change the base image (what I intended to do)
FROM myownbase
ENV JAVA_APP_DIR /deployments
COPY maven /deployments/
EXPOSE 8080 8778 9779
- Place the
Dockerfile
insrc/main/docker
, fmp won’t pick it up. - Specify dockerfile directory in
pom.xml
<images>
<image>
<name>my-own-image</name>
<build>
<dockerFileDir>./</dockerFileDir>
</build>
</image>
</images>
fmp will now pick it up and build using this dockerfile, But FAIL at the COPY maven /deployments/
step, as it would be unable to find the maven
directory.
Workaround:
By @jstrachan
create a custom base image separately then just reference it like this https://github.com/fabric8io/generator-backend/blob/master/pom.xml#L39
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
When using an external Dockerfile, you get a default BusyBox image unless you specify dockerFileDir;
It would be better if it failed right away than give an unwanted/incorrect default busybox image too.
I guess what the user might be looking for here, is the simple dockerfile build (https://maven.fabric8.io/#simple-dockerfile-build ) where they specify the dockerfile on projects’ base directory location and nothing in XML config.,
This feature also has a problem since the Dockerfile isn’t being picked up in the simple dockerfile build mode, I have created an issue for that… Closing this issue in favour of https://github.com/fabric8io/fabric8-maven-plugin/issues/1814