Merge remote-tracking branch 'origin/master'

This commit is contained in:
many2many 2024-06-05 11:14:47 +08:00
commit 3b8ccb6f46
4 changed files with 8 additions and 10 deletions

View File

@ -3,18 +3,16 @@ WORKDIR /app
# 将Gradle的配置文件复制到镜像中
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
COPY src src
# 构建应用
RUN gradle bootJar
RUN ./gradlew bootJar
# 使用官方的Java运行时作为最终的运行环境
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY --from=build/libs /app/build/libs/*.jar app.jar
COPY --from=build /app/build/libs/*.jar app.jar
# 设置应用运行的端口
EXPOSE 8080

View File

@ -6,7 +6,7 @@ services:
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: mydb
MYSQL_DATABASE: paopao
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
volumes:

View File

@ -11,13 +11,12 @@ WORKDIR /app
# 将Gradle的配置文件复制到镜像中
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
COPY src src
# 构建应用
RUN gradle bootJar
RUN /app/gradlew bootJar
# 使用官方的Java运行时作为最终的运行环境
FROM openjdk:17-jdk-slim
@ -75,7 +74,8 @@ services:
- "8080:8080"
depends_on:
- db
environment:
- SPRING_PROFILES_ACTIVE=prod
volumes:
dbdata:
```

View File

@ -8,8 +8,8 @@ spring:
datasource:
url: jdbc:mysql://db:3306/paopao?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true # MySQL连接URLpaopao是数据库名
driverClassName: com.mysql.cj.jdbc.Driver # MySQL的Driver类名
username: root # MySQL用户名
password: root # MySQL密码
username: myuser # MySQL用户名
password: mypassword # MySQL密码
jpa:
show-sql: true