feat: 初始化笔记项目

- 新建后端项目 biji-houdaun,使用 Spring Boot 和 SQLite
- 新建前端项目 biji-qianduan,使用 Vue3
- 添加 Dockerfile 用于构建后端镜像
-配置 .gitignore 和 .gitattributes 文件
This commit is contained in:
ikmkj
2025-06-16 19:52:23 +08:00
commit 8a4bf2d245
21 changed files with 2527 additions and 0 deletions

2
biji-houdaun/.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf

33
biji-houdaun/.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

157
biji-houdaun/pom.xml Normal file
View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>biji-houdaun</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>biji-houdaun</name>
<description>biji-houdaun</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
<knife4j.version>4.5.0</knife4j.version>
<mybatis-plus.version>3.5.12</mybatis-plus.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 测试依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- sqlite -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.26</version>
</dependency>
<!-- Knife4j API 文档 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!-- MyBatis Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<!-- UUID 库,支持 UUID v7 -->
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>4.0.1</version>
</dependency>
<!-- 文件上传支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- SHA256计算工具 -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Bouncy Castle 加密库 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.76</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<imageName>${project.artifactId}</imageName>
<dockerHost>http://45.204.212.245:2375</dockerHost>
<!-- 指定使用外部Dockerfile -->
<dockerDirectory>src/main/java/com/test/docker</dockerDirectory>
<!-- <dockerDirectory>${project.basedir}</dockerDirectory>-->
<!-- 保留资源复制配置 -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
<resource>
<targetPath>/data</targetPath>
<directory>${project.basedir}</directory>
<include>mydatabase.db</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
<!-- 资源过滤-->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,13 @@
package com.test.bijihoudaun;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BijiHoudaunApplication {
public static void main(String[] args) {
SpringApplication.run(BijiHoudaunApplication.class, args);
}
}

View File

@@ -0,0 +1,40 @@
# 使用轻量级Alpine基础镜像 (Java 17 JRE)
FROM eclipse-temurin:17-jre-alpine
# 更换Alpine镜像源为国内源解决网络问题
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装SQLite动态库和时区数据 (关键步骤)
RUN apk add --no-cache sqlite tzdata && \
# 设置中国时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
# 清理时区缓存
apk del tzdata && \
rm -rf /var/cache/apk/*
# 设置工作目录
WORKDIR /app
# 复制构建好的jar文件修正路径
COPY *.jar app.jar
# 创建数据目录并确保可写
RUN mkdir -p /data && chmod a+rw /data
# 复制数据库文件(来自构建上下文)
COPY data/mydatabase.db /data/mydatabase.db
# 设置环境变量,test 激活测试环境
ENV SPRING_PROFILES_ACTIVE=test \
JAVA_OPTS="-Xmx512m -XX:MaxRAMPercentage=75"
# 暴露应用端口
EXPOSE 8083
# 添加健康检查
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --quiet --tries=1 --spider http://localhost:8082/actuator/health || exit 1
# 启动应用 (使用exec形式支持JVM参数)
ENTRYPOINT exec java $JAVA_OPTS -jar app.jar

View File

@@ -0,0 +1,12 @@
spring:
datasource:
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:C:\\it\\houtaigunli\\liu\\mydatabase.db
jpa:
hibernate:
ddl-auto: none
show-sql: true
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.SQLiteDialect

View File

@@ -0,0 +1,12 @@
spring:
datasource:
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:/data/mydatabase.db
jpa:
hibernate:
ddl-auto: none
show-sql: true
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.SQLiteDialect

View File

@@ -0,0 +1,21 @@
spring:
application:
name: biji-houdaun
profiles:
active: dev
servlet:
multipart:
max-file-size: 10MB # ???????5MB
max-request-size: 10MB # ???????5MB
#??
server:
port: 8083
## Snowflake ID?????
# ????ID (0~31)
worker:
id: 1
# ????ID (0~31)
datacenter:
id: 1