From 2e4c1046a008868a844e1f00be84672860fe5227 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Thu, 16 Oct 2025 17:41:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0Docker=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 ++++++ src/main/resources/application-docker.yml | 13 +++++++++---- src/main/resources/application.yml | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c189e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM openjdk:17-jdk +ARG JAR_FILE=target/*.jar +COPY $JAR_FILE app.jar +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone +ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/src/main/resources/application-docker.yml b/src/main/resources/application-docker.yml index 1ea4742..a7d441c 100644 --- a/src/main/resources/application-docker.yml +++ b/src/main/resources/application-docker.yml @@ -1,9 +1,14 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://mysql:3306/food_hub?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false - username: docker - password: 19940822Cxx + url: jdbc:mysql://host.docker.internal:3306/food_hub?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: root + password: 19940822Cxx@1213 file: - path: /upload-file/ \ No newline at end of file + path: /upload-file/ + +logging: + fluentd: + host: host.docker.internal + port: 24224 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9c560d5..3a5d715 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,12 +1,12 @@ server: - port: 8100 + port: 8083 spring: application: name: @project.artifactId@ version: @project.version@ profiles: - active: dev + active: docker # mybatis plus mapper路径 mybatis-plus: