mirror of
https://github.com/blossom-editor/blossom.git
synced 2026-03-12 17:41:26 +08:00
optimize: backend dockerfile support
- move Dockerfile to dir blossom-backend - add some content in blossom-backend readme doc - fix schema-mysql.sql create table blossom_article_reference when exists.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
FROM eclipse-temurin:8-jre as builder
|
||||
WORKDIR application
|
||||
ARG JAR_FILE=blossom-backend/backend/target/*.jar
|
||||
ARG JAR_FILE=backend/target/*.jar
|
||||
COPY ${JAR_FILE} application.jar
|
||||
RUN java -Djarmode=layertools -jar application.jar extract
|
||||
|
||||
@@ -19,3 +19,52 @@ root
|
||||
└─ expand-tracker 自研的链路追踪核心模块, 源自 tracker-core, 仅提供本地日志记录和日志中插入 Trace 的功能。
|
||||
└─ script 数据库与启动脚本
|
||||
```
|
||||
|
||||
# 编译镜像
|
||||
|
||||
### Linux编译
|
||||
|
||||
安装好`Docker`环境,安装好`git`,克隆代码仓库,
|
||||
|
||||
在 `blossom-backend` 目录下,运行如下命令:
|
||||
|
||||
```shell
|
||||
maven install
|
||||
```
|
||||
|
||||
```shell
|
||||
docker build -t jasminexzzz/blossom:dev -f Dockerfile .
|
||||
```
|
||||
|
||||
等待编译完成后,
|
||||
通过 `docker images` 可以查看到存在镜像 `jasminexzzz/blossom:dev`
|
||||
|
||||
### 本地开发
|
||||
|
||||
这里使用的是 `IntelliJ IDEA`,
|
||||
如果开发机器是Windows,则需要安装好 `Docker for Windows`
|
||||
如果开发机器是其它的,需要安装好`Docker`环境
|
||||
|
||||
1. 编辑配置
|
||||
2. 添加Dockerfile运行配置
|
||||
3. 配置如下参数
|
||||
- 服务器目录:本地的`Docker for Windows`
|
||||
- Dockerfile: blossom-backend\Dockerfile
|
||||
- 镜像标记:jasminexzzz/blossom:dev
|
||||
4. 添加执行前操作: 添加 运行Maven目标,配置命令 `clean package`,确认
|
||||
5. 确定保存
|
||||
|
||||
### 运行镜像的参数参考
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
--name blossom-dev \
|
||||
-p 9988:9999 \
|
||||
-v ~/blossom:/home/bl \
|
||||
jasminexzzz/blossom:dev \
|
||||
--spring.profiles.active=prod \
|
||||
--project.iaas.blos.domain="http://192.168.2.222:9988/pic/" \
|
||||
--spring.datasource.url="jdbc:mysql://192.168.2.222:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8" \
|
||||
--spring.datasource.username=root \
|
||||
--spring.datasource.password=123456
|
||||
```
|
||||
@@ -274,7 +274,7 @@ CREATE TABLE IF NOT EXISTS `blossom_article_open` (
|
||||
-- ----------------------------
|
||||
-- Table structure for blossom_article_reference
|
||||
-- ----------------------------
|
||||
CREATE TABLE `blossom_article_reference` (
|
||||
CREATE TABLE IF NOT EXISTS `blossom_article_reference` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`source_id` bigint NOT NULL COMMENT '文章ID',
|
||||
`source_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文章名称',
|
||||
|
||||
Reference in New Issue
Block a user