news 2026/5/2 5:13:22

借助gitee仓库构建私有图床

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
借助gitee仓库构建私有图床
  • 架构和准备
  • 具体实现细节
    • 仓库和源码地址
    • 服务端
    • yaml配置
    • 启动类
    • 同步git 云图
  • 演示

借助gitee仓库构建私有图床

架构和准备

  1. 创建gitee服务端仓库
  2. 创建gitee图床仓库
  3. 日常图片存储gitee仓库,通过git提交,保障本地电脑和云上备份双份
  4. 创建spring-boot服务端应用,实现预览图片路径为gitee图床
  5. 创建spring-boot客户端应用,实现远程服务端同步git pull命令
  6. 部署服务通过nginx域名代理
  7. 服务端部署

具体实现细节

仓库和源码地址

gitee 图片仓库[https://gitee.com/kcnf_open/wiki]

gitee 服务端仓库[https://gitee.com/kcnf_open/kcnf-wiki]

服务端
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
yaml配置
#app server: port: 8086 servlet: context-path: / #spring spring: main: allow-bean-definition-overriding: true devtools: restart: enabled: false profiles: active: dev web: resources: static-locations: file:${IMAGE_BASE_PATH:/data/wiki}/, classpath:/static/
启动类
package com.jysemel.kcnf; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import org.springframework.scheduling.annotation.EnableScheduling; /** * @author jysemel */ @Slf4j @EnableScheduling @SpringBootApplication public class WikiApplication implements CommandLineRunner { @Autowired private ApplicationContext context; public static void main(String[] args) { log.info("砍材农夫 开始启动........................................"); SpringApplication.run(WikiApplication.class, args); log.info("砍材农夫 启动成功........................................"); } @Override public void run(String... args) throws Exception { // 更简单的方法:直接输出配置值 String path = context.getEnvironment().getProperty("IMAGE_BASE_PATH"); log.info(">>> IMAGE_BASE_PATH {}", path); log.info(">>> static-locations {}" , context.getEnvironment().getProperty("spring.web.resources.static-locations")); } }
同步git 云图
package com.jysemel.kcnf.controller; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.io.IOException; @Slf4j @RestController public class GitController { @Autowired private ApplicationContext context; @SneakyThrows @GetMapping("/admin/pull") public String pull() throws IOException { String path = context.getEnvironment().getProperty("IMAGE_BASE_PATH"); log.info(">>> IMAGE_BASE_PATH {}", path); Process process = Runtime.getRuntime().exec("git -C "+ path +" pull"); int code = process.waitFor(); return code == 0 ? "success" : "failed"; } }

演示

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/2 5:10:27

STM32驱动开发避坑:三种微秒延时实现实测(SysTick/FreeRTOS/定时器)

STM32驱动开发避坑&#xff1a;三种微秒延时实现实测&#xff08;SysTick/FreeRTOS/定时器&#xff09; 在嵌入式开发中&#xff0c;精确的微秒级延时往往是驱动开发成败的关键。我曾在一个SPI设备驱动项目中&#xff0c;因为5微秒的时序偏差导致整个通信链路失效&#xff0c;花…

作者头像 李华
网站建设 2026/5/2 5:07:14

语言模型训练中的梯度瓶颈优化策略

1. 语言模型训练中的梯度瓶颈现象剖析在大型语言模型训练过程中&#xff0c;LM Head&#xff08;语言模型头部&#xff09;的梯度计算环节存在一个鲜少被讨论却影响深远的性能瓶颈。这个现象在模型参数量超过百亿级别后尤为明显——当反向传播计算梯度到达输出层时&#xff0c;…

作者头像 李华
网站建设 2026/5/2 5:00:27

告别Hive表烦恼:用Apache Iceberg构建数据湖的5个实战场景与避坑经验

告别Hive表烦恼&#xff1a;用Apache Iceberg构建数据湖的5个实战场景与避坑经验 如果你还在为Hive表的分区变更、并发写入冲突或历史回溯缺失而头疼&#xff0c;那么Apache Iceberg可能是你数据湖架构升级的最佳选择。作为新一代开放表格式标准&#xff0c;Iceberg正在彻底改变…

作者头像 李华
网站建设 2026/5/2 4:58:24

Linux设备树(DTS)实战:从语法到调试,一个驱动工程师的踩坑实录

Linux设备树实战:从语法陷阱到调试艺术的深度指南 引言:为什么设备树是驱动开发的必修课? 第一次接触设备树时,我正为一个定制化的PCIe采集卡编写驱动。硬件手册上密密麻麻的寄存器说明和中断线路图让我意识到:传统的platform_device方式已经无法应对这种复杂硬件拓扑。…

作者头像 李华