Aleksandr Erokhin
Aleksandr Erokhin

Reputation: 1982

Spring Boot 2.3.0 buildpack builds image with creation date 40 years ago

I've tried to use buildpack in a maven project with Spring Boot 2.3.0 running:

mvn spring-boot:build-image

Image was created just fine, but I see the following info for it:

REPOSITORY                                    TAG                     IMAGE ID            CREATED             SIZE
gcr.io/paketo-buildpacks/builder              base-platform-api-0.3   daceb4f909b7        40 years ago        690MB
myimage                                       master                  a482a4a34379        40 years ago        285MB

Why does it say the image (along with the builder) was created 40 years ago?

Upvotes: 25

Views: 5946

Answers (3)

Kipruto Barno
Kipruto Barno

Reputation: 7

For maven projects, add the following configurations to your POM file

<plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <configuration>
      <image>
         <name>${project.artifactId}:latest</name>
            <env>
               <BP_JVM_VERSION>21.*</BP_JVM_VERSION>
            </env>
            <createdDate>${maven.build.timestamp}</createdDate>
      </image>
   </configuration>
</plugin>

Upvotes: -1

kozla13
kozla13

Reputation: 1942

In the new version you can set it. Hier is the gradle example

bootBuildImage {
      imageName = "docker.io/ringo"
      createdDate = "now"
}

Upvotes: 10

codefinger
codefinger

Reputation: 10338

This is by design. In order to create reproducible builds (i.e. so that layers can be reused) the buildpack must create layers with a fixed time stamp. Otherwise, you wouldn’t be able to reuse the layers you created in previous builds because they would have different time stamps.

Upvotes: 14

Related Questions