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

View File

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

View File

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

View File

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