Reputation: 12835
I need to add self-signed certificates to a spring-boot docker image using spring-boot:build-image
and paketo-buildpacks/ca-certificates
but couldn't get it working.
So:
paketo-buildpacks/ca-certificates
bindings?mvn spring-boot:build-image
?What I tried with no success so far:
update pom.xml spring-boot-maven-plugin
:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<bindings>
<binding>${basedir}/bindings/ca-certificates:/platform/bindings/ca-certificates</binding>
</bindings>
</image>
</configuration>
<executions>
<execution>
<goals>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
from ${basedir}
folder:
mkdir bindings
mkdir bindings/ca-certificates
echo "ca-certificates" > bindings/ca-certificates/type
cp ~/.ssh/mycert.pem bindings/ca-certificates/
mvn spring-boot:build-image
Edit: moved image bindings configuration directly under boot-plugin (rather than inside a specific execution) as suggested by @nick-valanos and solved the problem.
Upvotes: 4
Views: 5188
Reputation: 79
I kind of had the same issue and I found your post really helpful. After a bit playing around, I found that your configuration would also work with spring-boot:build-image
with the following alterations:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<bindings>
<binding>${basedir}/bindings/ca-certificates:/platform/bindings/ca-certificates</binding>
</bindings>
</image>
</configuration>
</plugin>
As you can see, I added the <configuration>
immediately after <plugin>
. That way, it seems that it is parceable by spring-boot:build-image
Upvotes: 6
Reputation: 12835
I got it. Maven configuration above is for maven package
target, not spring-boot:build-image
.
Here is the complete procedure:
bindings/ca-certificates
folder at maven project root and add to it:
type
file containing just ca-certificates
build-image
execution to spring-boot-maven-plugin
with ${basedir}/bindings/ca-certificates:/platform/bindings/ca-certificates
image binding as configured in my questionmvn clean package
Upvotes: 9