add compose
This commit is contained in:
parent
267db90872
commit
f6578802ff
|
@ -0,0 +1,19 @@
|
||||||
|
version: '3.7'
|
||||||
|
name: demo-tomcat
|
||||||
|
services:
|
||||||
|
platfoem:
|
||||||
|
image: svn.youshengyun.com:9923/risenet-y9boot-webapp-platform-jvm:v9.7.0-SNAPSHOT
|
||||||
|
container_name: demo-tomcat01
|
||||||
|
restart: always
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- y9-share-net
|
||||||
|
ports:
|
||||||
|
- "7199:7099"
|
||||||
|
environment:
|
||||||
|
- y9.login.casLoginView=casLoginView-y9-v3.0
|
||||||
|
|
||||||
|
networks:
|
||||||
|
y9-share-net:
|
||||||
|
external: true
|
67
pom.xml
67
pom.xml
|
@ -30,7 +30,7 @@
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.build.timestamp.format>yyyy-MM-dd_HH_mm_ss</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyyMMdd-HHmmss</maven.build.timestamp.format>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -51,11 +51,24 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>demo-tomcat##${build.timestamp}</finalName>
|
<finalName>${project.artifactId}##${buildNumber}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<additionalProperties>
|
||||||
|
<build.timestamp>${buildNumber}</build.timestamp>
|
||||||
|
<java.version>${java.version}</java.version>
|
||||||
|
</additionalProperties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!--<plugin>
|
<!--<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
@ -85,14 +98,60 @@
|
||||||
<goal>timestamp-property</goal>
|
<goal>timestamp-property</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<name>build.timestamp</name>
|
<name>buildNumber</name>
|
||||||
<pattern>yyyyMMdd-HHmmss</pattern>
|
<pattern>yyyyMMdd-HHmmss</pattern>
|
||||||
<timeZone>GMT+8</timeZone>
|
<timeZone>GMT+08:00</timeZone>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>build-docker-image</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>false</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.google.cloud.tools</groupId>
|
||||||
|
<artifactId>jib-maven-plugin</artifactId>
|
||||||
|
<version>3.4.3</version>
|
||||||
|
<configuration>
|
||||||
|
<skip>false</skip>
|
||||||
|
<from>
|
||||||
|
<image>tomcat:jdk21-temurin</image>
|
||||||
|
</from>
|
||||||
|
<container>
|
||||||
|
<appRoot>/usr/local/tomcat/webapps/${project.artifactId}</appRoot>
|
||||||
|
</container>
|
||||||
|
<to>
|
||||||
|
<image>svn.youshengyun.com:9923/${project.artifactId}-jib</image>
|
||||||
|
<tags>
|
||||||
|
<tag>${project.version}</tag>
|
||||||
|
<tag>latest</tag>
|
||||||
|
</tags>
|
||||||
|
<auth>
|
||||||
|
<username>publisher</username>
|
||||||
|
<password>83204585</password>
|
||||||
|
</auth>
|
||||||
|
</to>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.example.demo.controller;
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.info.BuildProperties;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -7,9 +9,11 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class MainController {
|
public class MainController {
|
||||||
|
@Autowired
|
||||||
|
private BuildProperties buildProperties;
|
||||||
|
|
||||||
@GetMapping({ "", "/" })
|
@GetMapping({ "", "/" })
|
||||||
public String index(HttpServletRequest request) {
|
public String index(HttpServletRequest request) {
|
||||||
return "hello demo-tomcat";
|
return "hello demo-tomcat " + buildProperties.get("build.timestamp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue