From 21978da02ae23542ef237ec4e47d79d80239b313 Mon Sep 17 00:00:00 2001 From: Anthony Dahanne Date: Wed, 8 Mar 2023 13:00:44 -0500 Subject: [PATCH 1/2] Add documentation for publishing images with Maven command line See gh-34517 --- .../docs/asciidoc/packaging-oci-image.adoc | 19 ++++++++++++++++ ...docker-pom-authentication-command-line.xml | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/packaging-oci-image/docker-pom-authentication-command-line.xml diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc index e4c02f553b83..e1ea3b923b57 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc @@ -357,6 +357,25 @@ The `publish` option can be specified on the command line as well, as shown in t $ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 -Dspring-boot.build-image.publish=true ---- +If you intend to invoke the `publish` option on the command line, with authentication, you'll need the combination of this command line: + +[indent=0] +---- + $ mvn spring-boot:build-image \ + -Ddocker.publishRegistry.username=user \ + -Ddocker.publishRegistry.password=secret \ + -Ddocker.publishRegistry.url=docker.example.com \ + -Dspring-boot.build-image.publish=true \ + -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 \ +---- + +and this XML configuration: + +[source,xml,indent=0,subs="verbatim,attributes",tabsize=4] +---- +include::../maven/packaging-oci-image/docker-pom-authentication-command-line.xml[tags=docker] +---- + [[build-image.examples.caches]] === Builder Cache Configuration diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/packaging-oci-image/docker-pom-authentication-command-line.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/packaging-oci-image/docker-pom-authentication-command-line.xml new file mode 100644 index 000000000000..fd688ea0b237 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/packaging-oci-image/docker-pom-authentication-command-line.xml @@ -0,0 +1,22 @@ + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + ${docker.publishRegistry.url} + ${docker.publishRegistry.username} + ${docker.publishRegistry.password} + + + + + + + + \ No newline at end of file From ad680ed4ea14f1c6ac9ffe82193ee5fab148af37 Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Thu, 9 Mar 2023 14:21:08 -0600 Subject: [PATCH 2/2] Polish "Add documentation for publishing images with Maven command line" See gh-34517 --- .../src/docs/asciidoc/packaging-oci-image.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc index e1ea3b923b57..38f3d6cc6dc3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc @@ -357,7 +357,7 @@ The `publish` option can be specified on the command line as well, as shown in t $ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 -Dspring-boot.build-image.publish=true ---- -If you intend to invoke the `publish` option on the command line, with authentication, you'll need the combination of this command line: +When using the `publish` option on the command line with authentication, you can provide credentials using properties as in this example: [indent=0] ---- @@ -366,10 +366,10 @@ If you intend to invoke the `publish` option on the command line, with authentic -Ddocker.publishRegistry.password=secret \ -Ddocker.publishRegistry.url=docker.example.com \ -Dspring-boot.build-image.publish=true \ - -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 \ + -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 ---- -and this XML configuration: +and reference the properties in the XML configuration: [source,xml,indent=0,subs="verbatim,attributes",tabsize=4] ----