diff --git a/Dockerfile b/Dockerfile index 732d8eb..0fa052f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM maven:3.8.7-openjdk-18 as builder WORKDIR /tmp -RUN git clone https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2 && \ +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE +RUN echo $BUILDDATE && git clone https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2 && \ cd Facti13.Web.Backend.Java.V2 && \ mvn -f pom.xml clean package FROM eclipse-temurin:18 diff --git a/src/main/java/app/MainApi.java b/src/main/java/app/MainApi.java index 17e26e0..91c1da2 100644 --- a/src/main/java/app/MainApi.java +++ b/src/main/java/app/MainApi.java @@ -3,9 +3,16 @@ package app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import java.time.Instant; + @SpringBootApplication public class MainApi { public static void main(String[] args) { + try { + System.out.printf("Build date: %s\n", Instant.ofEpochSecond(Long.parseLong(System.getenv("BUILDDATE")))); + } catch (Exception err) { + System.out.println("Cannot parse build date"); + } SpringApplication.run(MainApi.class, args); } } diff --git a/src/main/java/app/entities/Stats.java b/src/main/java/app/entities/Stats.java index 41216f2..d1106da 100644 --- a/src/main/java/app/entities/Stats.java +++ b/src/main/java/app/entities/Stats.java @@ -24,6 +24,15 @@ public class Stats { HashMap uniq = new HashMap<>(); HashMap updates = new HashMap<>(); Statistic statistic = new Statistic(); + String builddate = ""; + + public Stats(){ + try { + builddate = System.getenv("BUILDDATE"); + } catch (Exception err) { + builddate = "0"; + } + } @JsonGetter public Statistic getStatistic() {