javaspring-bootdockergradlejib

Stop packaging application-local properties in Docker image


I have a Spring Boot application that includes several application-XXX.properties profiles. When I build Docker image using jib, I notice that all these properties files are packaged in the image in /app/resouces.

Is there a way to only include the main application.properties and prevent including the specific properties for various profiles in the Docker image? This could potentially leak some sensitive details if left there.

Is this some jib gradle configuration?


Solution

  • Don't include them in the folders packed to the JAR file. I suggest the following structure:

    app
    │
    ├── pom.xml
    ├── ext
    │   └── application-localhost.properties
    └── src
        ├── main
        │   ├── java
        │   │   └── ...
        │   └── resources
        │       └── application.properties
        └── test
            ├── java
            │   └── ...
            └── resources
                └── ...