From 72d06f986108256e947beee1e454e806d5d7bbfb Mon Sep 17 00:00:00 2001 From: kanade Date: Mon, 30 May 2022 16:50:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 60 ++++++++++ Dockerfile | 11 ++ Dockerfile.drone | 6 + .../controller/TaskController.java | 34 +++--- src/main/resources/application-test.yml | 113 ++++++++++++++++++ 5 files changed, 207 insertions(+), 17 deletions(-) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 Dockerfile.drone diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..fb0c027 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,60 @@ +kind: pipeline +type: docker +name: master +steps: + - name: restore-cache + image: meltwater/drone-cache + settings: + backend: filesystem + restore: true + cache_key: "maven" + archive_format: gzip + filesystem_cache_root: "/var/lib/cache" + mount: + - "maven" + volumes: + - name: cache + path: "/var/lib/cache" + # Do stuff.. + - name: build + image: maven:3.8-openjdk-8 + commands: + - mkdir /root/.m2 + - cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml + - sed -i 's/\\/usr\\/share\\/maven\\/ref\\/repository/\\/drone\\/src\\/maven/g' /root/.m2/settings.xml + - mvn package + - name: rebuild-cache + image: meltwater/drone-cache + settings: + backend: filesystem + rebuild: true + cache_key: "maven" + archive_format: gzip + filesystem_cache_root: "/var/lib/cache" + mount: + - "maven" + volumes: + - name: cache + path: "/var/lib/cache" + - name: docker + image: plugins/docker + settings: + dockerfile: "Dockerfile.drone" + repo: harbor.oa00.com/sws/project0512 + registry: harbor.oa00.com + username: + from_secret: docker_username + password: + from_secret: docker_password + tags: + - master +volumes: + - name: cache + host: + path: "/var/lib/cache" +trigger: + branch: + - master + event: + - push + - merge \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..920dc6a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# 编译 +FROM maven:3.8-openjdk-8 +COPY . /build/ +WORKDIR /build +RUN mvn package +# 运行阶段 +FROM openjdk:8-jdk-alpine +# 从编译阶段的中拷贝编译结果到当前镜像中 +COPY --from=0 /build/target/project0512-0.0.1-SNAPSHOT.jar /work/project0512-0.0.1-SNAPSHOT.jar +WORKDIR /work +ENTRYPOINT ["java","-jar","project0512-0.0.1-SNAPSHOT.jar","--spring.profiles.active=test"] diff --git a/Dockerfile.drone b/Dockerfile.drone new file mode 100644 index 0000000..71fc91a --- /dev/null +++ b/Dockerfile.drone @@ -0,0 +1,6 @@ +FROM openjdk:8-jdk-alpine +# 从编译阶段的中拷贝编译结果到当前镜像中 +COPY ./target/project0512-0.0.1-SNAPSHOT.jar /work/project0512-0.0.1-SNAPSHOT.jar +WORKDIR /work +ENTRYPOINT ["java","-jar","project0512-0.0.1-SNAPSHOT.jar","--spring.profiles.active=test"] + diff --git a/src/main/java/com/zh/project0512/controller/TaskController.java b/src/main/java/com/zh/project0512/controller/TaskController.java index 6352723..7afe24a 100644 --- a/src/main/java/com/zh/project0512/controller/TaskController.java +++ b/src/main/java/com/zh/project0512/controller/TaskController.java @@ -125,22 +125,22 @@ public class TaskController { return Result.success(obj); } - @Data - static class StatusTaskParam { - @NotNull(message = "id不能为空") - @Min(value = 1, message = "id最小值为1") - @Schema(title = "任务id") - private Integer id; - @Schema(title = "任务id") - private Integer id; - @Schema(title = "任务id") - private Integer id; - } - - @Operation(summary = "详情") - @PostMapping("/detail") - public Result detail(@Validated @RequestBody StatusTaskParam param) { - - } +// @Data +// static class StatusTaskParam { +// @NotNull(message = "id不能为空") +// @Min(value = 1, message = "id最小值为1") +// @Schema(title = "任务id") +// private Integer id; +// @Schema(title = "任务id") +// private Integer id; +// @Schema(title = "任务id") +// private Integer id; +// } +// +// @Operation(summary = "详情") +// @PostMapping("/detail") +// public Result detail(@Validated @RequestBody StatusTaskParam param) { +// +// } } diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index e69de29..5f810ef 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -0,0 +1,113 @@ +server: + port: 8080 + +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://mysql:3306/project0512?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + username: project0512 + password: zhang123. + hikari: + max-lifetime: 500000 + + redis: + host: redis + port: 6379 + password: + database: 15 # 指定redis的分库(共16个0到15) + timeout: 5000 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + serialization: + write-dates-as-timestamps: false + resources: + static-locations: classpath:templates/,classpath:static/ + mvc: + view: + prefix: / + suffix: .html + servlet: + multipart: + max-file-size: 10MB + max-request-size: 100MB +pagehelper: + reasonable: false # 禁用合理化时,如果pageNum<1或pageNum>pages会返回空数据 + support-methods-arguments: true + params: count=countSql + row-bounds-with-count: true + helper-dialect: mysql + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + auto-mapping-behavior: full + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + mapper-locations: classpath*:mapper/**/*Mapper.xml + global-config: + # 逻辑删除配置 + db-config: + # 删除前 + logic-not-delete-value: 1 + # 删除后 + logic-delete-value: 0 +web: + uploadPath: /www/wwwroot/project0512/upload/ + +#springdoc: +# swagger-ui: +# # 修改Swagger UI路径 +# path: /swagger-ui.html +# # 开启Swagger UI界面 +# enabled: true +# api-docs: +# # 修改api-docs路径 +# path: /v3/api-docs +# # 开启api-docs +# enabled: true +# # 配置需要生成接口文档的扫描包 +# packages-to-scan: com.macro.mall.tiny.controller +# # 配置需要生成接口文档的接口路径 +# paths-to-match: /brand/**,/admin/** + + +#mybatis: +# mapper-locations: classpath:mapper/*Mapper.xml +# type-aliases-package: com.loong.entity + +#showSql +logging: + level: + com: + example: + mapper: debug + +# mac图片地址 +#img_upload_path: /Users/apple/Pictures +# 服务器图片地址 +img_upload_path: /img/upload/ + +# 阿里云oss配置信息 +oss: + endpoint: oss-cn-shanghai.aliyuncs.com + accessKeyId: LTAI5tBTznxwb5K6DQBrp4f5 + accessKeySecret: HfXoc11JgTZt4YHzG1mnty4XpOzcz3 + bucketName: default-bucket-zh2 + +wx: + appid: wx8c9da118d7ff7200 + secret: a0af1bd6c400930bce8b2be54b9660c7 + +# 抖音开放平台配置信息 +dy: + clientKey: awty3wnxx90jper9 #抖音开放平台key + clientSecret: 88445885e689ce242a9dae43a047637e #抖音开放平台密钥 + scope: data.external.user,data.external.item,fans.data,user_info,renew_refresh_token,data.external.user#需要用户开放的权限 + responseType: code #填写code就行 + redirectUri: douyin.oa00.com #扫码之后的回调地址 + state: false + +ks: + appid: ks678354694850100396 + secret: ypJaxhE6340upTxMicajnA + redirectUrl: https://kuaishou.oa00.com