Skip to content

Commit bf48c6c

Browse files
Merge pull request #34517 from anthonydahanne
* gh-34517: Polish "Add documentation for publishing images with Maven command line" Add documentation for publishing images with Maven command line Closes gh-34517
2 parents 932c203 + ad680ed commit bf48c6c

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,25 @@ The `publish` option can be specified on the command line as well, as shown in t
357357
$ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 -Dspring-boot.build-image.publish=true
358358
----
359359

360+
When using the `publish` option on the command line with authentication, you can provide credentials using properties as in this example:
361+
362+
[indent=0]
363+
----
364+
$ mvn spring-boot:build-image \
365+
-Ddocker.publishRegistry.username=user \
366+
-Ddocker.publishRegistry.password=secret \
367+
-Ddocker.publishRegistry.url=docker.example.com \
368+
-Dspring-boot.build-image.publish=true \
369+
-Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1
370+
----
371+
372+
and reference the properties in the XML configuration:
373+
374+
[source,xml,indent=0,subs="verbatim,attributes",tabsize=4]
375+
----
376+
include::../maven/packaging-oci-image/docker-pom-authentication-command-line.xml[tags=docker]
377+
----
378+
360379
[[build-image.examples.caches]]
361380
=== Builder Cache Configuration
362381

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- tag::docker[] -->
3+
<project>
4+
<build>
5+
<plugins>
6+
<plugin>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-maven-plugin</artifactId>
9+
<configuration>
10+
<docker>
11+
<publishRegistry>
12+
<url>${docker.publishRegistry.url}</url>
13+
<username>${docker.publishRegistry.username}</username>
14+
<password>${docker.publishRegistry.password}</password>
15+
</publishRegistry>
16+
</docker>
17+
</configuration>
18+
</plugin>
19+
</plugins>
20+
</build>
21+
</project>
22+
<!-- end::docker[] -->

0 commit comments

Comments
 (0)