dockermavenazure-devopsspring-boot-maven-plugin

Use multiple tags when creating Docker image using Spring Boot Maven Plugin


I am using the Spring Boot Maven Plugin to create Docker images. They are tagged with latest, but I would like to have 2 tags added to it.

This is my current config:

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <image>
                        <name>myacr.azurecr.io/${project.artifactId}</name>
                    </image>
                </configuration>
            </plugin>

I would like to have latest and a certain build number (which will come from the Azure DevOps pipeline).

Is this possible with the Maven plugin? I could not find any info in the docs about it.


Solution

  • This is now possible, not sure since when.

    Use the following configuration:

                <image>
                    <name>myacr.azurecr.io/${project.artifactId}</name>
                    <tags>
                        myacr.azurecr.io/${project.artifactId}:${project.version},myacr.azurecr.io/${project.artifactId}:latest
                    </tags>
                </image>
    

    Docs are here: Spring Boot Maven Plugin Tags

    No hint in the docs about the comma seperation, but it seems to work.