重构 admin 初始化:改为 JSON 配置,增加导入导出功能

This commit is contained in:
不胜舟
2026-01-16 18:48:57 +08:00
parent 12c31a8e8a
commit 372b0030c3
4 changed files with 2 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
FROM python:3.11-bookworm
# 复制项目文件
RUN mkdir -p /app
COPY . /app/
COPY ./dockerdata/start.sh /app/start.sh
WORKDIR /app/
# 设置必备项
ENV TIME_ZONE Asia/Shanghai
RUN echo "${TIME_ZONE}" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
# 安装必备库
RUN python3 -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
# 安装
RUN python3 -m pip install gunicorn -i https://pypi.tuna.tsinghua.edu.cn/simple/
# 初始化数据库
RUN flask db init
RUN flask db migrate
RUN flask db upgrade
RUN flask admin init
# 运行命令
RUN chmod +x start.sh
# 保持执行
CMD /bin/sh
+17
View File
@@ -0,0 +1,17 @@
version: '3'
services:
flask:
build:
context: ..
dockerfile: dockerdata/Dockerfile
container_name: flask
ports:
- "5000:5000"
restart: always
command: sh -c "/app/start.sh"
networks:
- bridge_network
networks:
bridge_network:
driver: bridge
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# 这里可以设置同步时间等操作
# 运行程序
echo "Starting application..."
# 这里可以修改运行命令
gunicorn -b 0.0.0.0:5000 app:app