Browse Source

дата сборки момент

master
gsd 2 years ago
parent
commit
b9bb98f105
  1. 4
      Dockerfile
  2. 7
      src/main/java/app/MainApi.java
  3. 9
      src/main/java/app/entities/Stats.java

4
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

7
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);
}
}

9
src/main/java/app/entities/Stats.java

@ -24,6 +24,15 @@ public class Stats {
HashMap<String, Long> uniq = new HashMap<>();
HashMap<String, Long> 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() {

Loading…
Cancel
Save