deploy:修改打包脚本
This commit is contained in:
parent
de0efdda2c
commit
9d5cdbf3a6
2
.gitignore
vendored
2
.gitignore
vendored
@ -102,3 +102,5 @@ dist
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
data
|
@ -1,7 +1,6 @@
|
||||
FROM node:lts-buster-slim
|
||||
WORKDIR /app
|
||||
copy ./openRenamerBackend /app
|
||||
RUN rm /app/sqls/* && chmod 777 /app/sqls
|
||||
ENV PORT 80
|
||||
CMD ["/usr/local/bin/node", "dist/index.js"]
|
||||
|
||||
|
13
build.sh
Normal file
13
build.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
base=$(cd "$(dirname "$0")";pwd)
|
||||
cd $base
|
||||
docker run -it --rm --name buildOpenRenamer --user ${UID} -v $base/openRenamerFront:/opt/front node:lts-buster-slim bash -c "cd /opt/front && yarn --registry https://registry.npm.taobao.org && yarn build"
|
||||
|
||||
rm -rf openRenamerBackend/static/*
|
||||
touch openRenamerBackend/static/.gitkeep
|
||||
mv openRenamerFront/dist/* openRenamerBackend/static
|
||||
|
||||
docker run -it --rm --name buildOpenRenamer --user ${UID} -v $base/openRenamerBackend:/opt/backend node:lts-buster-slim bash -c "cd /opt/backend && yarn config set registry https://registry.npm.taobao.org && yarn global add typescript && yarn && tsc"
|
||||
|
||||
# docker镜像打包
|
||||
# docker build -t fleyx:open-renamer:0.3 .
|
@ -12,12 +12,16 @@ class SqliteHelper {
|
||||
public static pool: Database = null;
|
||||
|
||||
static async createPool() {
|
||||
let dataFolder = path.join(config.rootPath, "data");
|
||||
if (!fs.existsSync(dataFolder)) {
|
||||
fs.mkdir(dataFolder);
|
||||
}
|
||||
SqliteHelper.pool = await open({
|
||||
filename: path.join(config.rootPath, "database.db"),
|
||||
filename: path.join(dataFolder, "database.db"),
|
||||
driver: sqlite3.Database
|
||||
});
|
||||
let basePath = path.join(config.rootPath, "sqls");
|
||||
let hisPath = path.join(basePath, HISTORY_NAME);
|
||||
let hisPath = path.join(dataFolder, HISTORY_NAME);
|
||||
let history: Array<string>;
|
||||
if (fs.existsSync(hisPath)) {
|
||||
history = JSON.parse(await fs.readFile(hisPath, "utf-8"));
|
||||
@ -32,7 +36,7 @@ class SqliteHelper {
|
||||
log.info("sql无需重复执行:", files[i]);
|
||||
continue;
|
||||
}
|
||||
let sqlLines = (await fs.readFile(path.join(basePath, files[i]), 'utf-8')).split(/[\r\n]/g).map(item=>item.trim()).filter(item=>!item.startsWith("--"));
|
||||
let sqlLines = (await fs.readFile(path.join(basePath, files[i]), 'utf-8')).split(/[\r\n]/g).map(item => item.trim()).filter(item => !item.startsWith("--"));
|
||||
try {
|
||||
let sql = "";
|
||||
for (let j = 0; j < sqlLines.length; j++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user