update compose

This commit is contained in:
dingz 2023-10-27 13:36:45 +08:00
parent 02b1991015
commit ffc3b0c792
4 changed files with 79 additions and 7 deletions

View File

@ -1,6 +1,5 @@
version: '3.9' version: '3.9'
name: demo01 name: demo01
#Grafana官方提供模板地址https://grafana.com/grafana/dashboards
services: services:
demo01: demo01:
image: docker.io/library/demo01:1.0 image: docker.io/library/demo01:1.0
@ -12,8 +11,13 @@ services:
- y9-share-net - y9-share-net
ports: ports:
- "7055:7055" - "7055:7055"
#volumes: labels:
# - d:/docker-data/grafana:/var/lib/grafana - "traefik.enable=true"
- "traefik.http.routers.demo01.entrypoints=web"
- "traefik.http.routers.demo01.rule=PathPrefix(`/demo01`)"
#- "traefik.http.services.demo01.loadbalancer.server.scheme=http"
#- "traefik.http.services.demo01.loadbalancer.server.port=7055"
#- "traefik.docker.network=y9-share-net"
networks: networks:
y9-share-net: y9-share-net:

68
pom.xml
View File

@ -104,4 +104,72 @@
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Spring-Boot-Native-Processed>true</Spring-Boot-Native-Processed>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>paketobuildpacks/builder-jammy-tiny</builder>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/graalvm</buildpack>
<buildpack>
gcr.io/paketo-buildpacks/java-native-image</buildpack>
</buildpacks>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
<BP_JVM_VERSION>17.0.9</BP_JVM_VERSION>
<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>--enable-preview</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
</env>
</image>
</configuration>
<executions>
<execution>
<id>process-aot</id>
<goals>
<goal>process-aot</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<classesDirectory>
${project.build.outputDirectory}</classesDirectory>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<requiredVersion>22.3</requiredVersion>
</configuration>
<executions>
<execution>
<id>add-reachability-metadata</id>
<goals>
<goal>add-reachability-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -10,7 +10,7 @@ import net.risesoft.demo.entity.User;
import net.risesoft.demo.repository.UserRepository; import net.risesoft.demo.repository.UserRepository;
@RestController @RestController
@RequestMapping("/api/users") @RequestMapping
public class UserController { public class UserController {
private final UserRepository userRepository; private final UserRepository userRepository;
@ -20,7 +20,7 @@ public class UserController {
this.userRepository = userRepository; this.userRepository = userRepository;
} }
@GetMapping @GetMapping({"", "/", "/api/users"})
public List<User> findAll(){ public List<User> findAll(){
return userRepository.findAll(); return userRepository.findAll();
} }

View File

@ -31,7 +31,7 @@ spring:
name: demo01 name: demo01
cloud: cloud:
consul: consul:
host: localhost host: host.docker.internal
port: 8500 port: 8500
discovery: discovery:
register-health-check: true register-health-check: true
@ -44,7 +44,7 @@ spring:
tags: test,y9 tags: test,y9
datasource: datasource:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://host.docker.internal:3306/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: '12345678' password: '12345678'
hikari: hikari: