question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

make it easy to use a src/main/docker/Dockerfile with property replacement

See original GitHub issue

So along with the ideas behind this for kubernetes yaml files https://github.com/fabric8io/fabric8/issues/5861 - I’m liking the idea of having a simple small default Dockerfile using maven properties; then its a natural place for folks to add any custom commands or environment variables using native docker syntax.

e.g. for an ‘executable jar’ style microservice we could use a standard Dockerfile like this:

FROM fabric8/java-jboss-openjdk8-jdk:1.0.10

ENV JAVA_APP_JAR ${project.build.finalName}.jar

ADD ${project.build.finalName}.jar /app

Or something fairly minimal like that. I’m kinda thinking that if folks choose to just write a small minimal Dockerfile (that mostly defines one or two env vars, defines the distro to add and the base image); they will usually want to use maven property filtering by default.

So having an option to enable & disable maven property filtering if specifying the assembly.dockerFileDir would be great. I wonder if we should just enable it by default?

Incidentally I wonder if we should also default the assembly.dockerFileDir value to something like src/main/docker if no other assembly is specified? Then if there is a suitable Dockerfile in src/main/docker then OOTB folks could run this on their project without changing their pom:

mvn io.fabric8:docker-maven-version:0.14.3:build

Or worst case folks could just create an empty maven plugin configuration:

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.14.2</version>
      </plugin>

so they can use

mvn docker:build

Am just thinking of the minimal pom.xml changing overhead of adding a simple Dockerfile referencing the projects build artefact; so there’s as little to edit on a project as possible

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
rhusscommented, May 16, 2017

Added now property replacement support via #777 and available in 0.21.0.

Documentation is here : https://dmp.fabric8.io/#build-filtering

1reaction
rodlogiccommented, Apr 28, 2016

This is also on my radar. Having an external Dockerfile is much cleaner since one doesn’t need to learn a new syntax for creating what ultimately is a Dockerfile. However, being able to replace properties is a must.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dockerfile reference - Docker Documentation
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image....
Read more >
Best practices for writing Dockerfiles - Docker Documentation
Best practices for writing Dockerfiles. This document covers recommended best practices and methods for building efficient images.
Read more >
docker buildx build
The buildx build command starts a build using BuildKit. This command is similar to the UI of docker build command and takes the...
Read more >
Store configuration data using Docker Configs
This is made easier by the ability to control the mount point of the config within a given container. To update a stack,...
Read more >
Manage sensitive data with Docker secrets
This is made easier by the ability to control the mount point of the secret within a given container. Read more about docker...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found