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 a5c053e..7afe24a 100644 --- a/src/main/java/com/zh/project0512/controller/TaskController.java +++ b/src/main/java/com/zh/project0512/controller/TaskController.java @@ -125,6 +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) { +// +// } } diff --git a/src/main/java/com/zh/project0512/controller/UtilsController.java b/src/main/java/com/zh/project0512/controller/UtilsController.java index 7a512bc..f74f60e 100644 --- a/src/main/java/com/zh/project0512/controller/UtilsController.java +++ b/src/main/java/com/zh/project0512/controller/UtilsController.java @@ -44,7 +44,7 @@ public class UtilsController { @Autowired private AliyunOss aliyunOss; - @Value("${img_upload_path}") + @Value("${web.uploadPath}") private String path; @Operation(summary="上传") @@ -58,14 +58,15 @@ public class UtilsController { // fileName=name;//图片名 // String suffixName = fileName.substring(fileName.lastIndexOf("."));//后缀名 //String path = System.getProperty("user.home"); //文件存储位置 我放在了我的项目下 - //获取jar包所在目录 - ApplicationHome h = new ApplicationHome(getClass()); - File jarF = h.getSource(); - //在jar包所在目录下生成一个upload文件夹用来存储上传的图片 - String dirPath = jarF.getParentFile().toString()+"/upload/"; - System.out.println(dirPath); - File dest = new File(dirPath+fileName); -// File dest = new File(path+"/"+fileName); +// //获取jar包所在目录 +// ApplicationHome h = new ApplicationHome(getClass()); +// File jarF = h.getSource(); +// //在jar包所在目录下生成一个upload文件夹用来存储上传的图片 +// String dirPath = jarF.getParentFile().toString()+"/upload/"; +// System.out.println(dirPath); +// System.out.println(path); +// File dest = new File(dirPath+fileName); + File dest = new File(path+"/"+fileName); if (!dest.getParentFile().exists()) { dest.getParentFile().mkdirs(); } diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 4cc48ab..6645cae 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,58 +1,58 @@ server: - port: 8081 + port: 8080 spring: - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://121.41.171.43:3306/project0512?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true - username: project0512 - password: zhang123. - hikari: - max-lifetime: 500000 + 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: 121.41.171.43 - port: 6379 - password: zhang123. - 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 + 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 + 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 + 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/ + uploadPath: /static/sws/upload/ #springdoc: # swagger-ui: @@ -77,10 +77,10 @@ web: #showSql logging: - level: - com: - example: - mapper: debug + level: + com: + example: + mapper: debug # mac图片地址 #img_upload_path: /Users/apple/Pictures @@ -89,25 +89,25 @@ img_upload_path: /img/upload/ # 阿里云oss配置信息 oss: - endpoint: oss-cn-shanghai.aliyuncs.com - accessKeyId: LTAI5tBTznxwb5K6DQBrp4f5 - accessKeySecret: HfXoc11JgTZt4YHzG1mnty4XpOzcz3 - bucketName: default-bucket-zh2 + endpoint: oss-cn-shanghai.aliyuncs.com + accessKeyId: LTAI5tBTznxwb5K6DQBrp4f5 + accessKeySecret: HfXoc11JgTZt4YHzG1mnty4XpOzcz3 + bucketName: default-bucket-zh2 wx: - appid: wx8c9da118d7ff7200 - secret: a0af1bd6c400930bce8b2be54b9660c7 + 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 + 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 + appid: ks678354694850100396 + secret: ypJaxhE6340upTxMicajnA + redirectUrl: https://kuaishou.oa00.com