mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-11 19:05:20 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b924483e7 | ||
|
|
b43bd61ac6 | ||
|
|
692c9a8d9e |
@@ -151,8 +151,6 @@ class Application {
|
|||||||
private setupMiddlewares() {
|
private setupMiddlewares() {
|
||||||
this.app.use(helmet({
|
this.app.use(helmet({
|
||||||
contentSecurityPolicy: false,
|
contentSecurityPolicy: false,
|
||||||
crossOriginOpenerPolicy: false,
|
|
||||||
originAgentCluster: false,
|
|
||||||
}));
|
}));
|
||||||
this.app.use(cors(config.cors));
|
this.app.use(cors(config.cors));
|
||||||
this.app.use(compression());
|
this.app.use(compression());
|
||||||
|
|||||||
@@ -104,11 +104,7 @@ const files = [
|
|||||||
export default async () => {
|
export default async () => {
|
||||||
for (const dirPath of directories) {
|
for (const dirPath of directories) {
|
||||||
if (!(await fileExist(dirPath))) {
|
if (!(await fileExist(dirPath))) {
|
||||||
try {
|
await fs.mkdir(dirPath);
|
||||||
await fs.mkdir(dirPath, { recursive: true });
|
|
||||||
} catch (err: any) {
|
|
||||||
Logger.warn(`Unable to create directory ${dirPath}: ${err.message}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,14 +65,11 @@ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
|
|||||||
&& git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
|
&& git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
|
||||||
&& mkdir -p ${QL_DIR}/static \
|
&& mkdir -p ${QL_DIR}/static \
|
||||||
&& cp -rf /static/* ${QL_DIR}/static \
|
&& cp -rf /static/* ${QL_DIR}/static \
|
||||||
&& rm -rf /static \
|
&& rm -rf /static
|
||||||
&& mkdir -p ${QL_DIR}/.tmp ${QL_DIR}/shell/preload \
|
|
||||||
&& chmod -R a+w ${QL_DIR}/.tmp ${QL_DIR}/shell/preload ${QL_DIR}/static
|
|
||||||
|
|
||||||
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
||||||
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
||||||
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3 \
|
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3 \
|
||||||
PM2_HOME=${QL_DIR}/data/.pm2 \
|
|
||||||
HOME=/root
|
HOME=/root
|
||||||
|
|
||||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME}:${PYTHON_HOME}/bin:${HOME}/bin \
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME}:${PYTHON_HOME}/bin:${HOME}/bin \
|
||||||
@@ -87,6 +84,6 @@ COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
|
|||||||
WORKDIR ${QL_DIR}
|
WORKDIR ${QL_DIR}
|
||||||
|
|
||||||
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
||||||
CMD curl -sf --noproxy '*' http://127.0.0.1:${QlPort:-5700}/api/health || exit 1
|
CMD curl -sf --noproxy '*' http://127.0.0.1:5700/api/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
||||||
|
|||||||
+2
-5
@@ -65,14 +65,11 @@ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
|
|||||||
&& git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
|
&& git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
|
||||||
&& mkdir -p ${QL_DIR}/static \
|
&& mkdir -p ${QL_DIR}/static \
|
||||||
&& cp -rf /static/* ${QL_DIR}/static \
|
&& cp -rf /static/* ${QL_DIR}/static \
|
||||||
&& rm -rf /static \
|
&& rm -rf /static
|
||||||
&& mkdir -p ${QL_DIR}/.tmp ${QL_DIR}/shell/preload \
|
|
||||||
&& chmod -R a+w ${QL_DIR}/.tmp ${QL_DIR}/shell/preload ${QL_DIR}/static
|
|
||||||
|
|
||||||
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
||||||
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
||||||
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3 \
|
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3 \
|
||||||
PM2_HOME=${QL_DIR}/data/.pm2 \
|
|
||||||
HOME=/root
|
HOME=/root
|
||||||
|
|
||||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME}:${PYTHON_HOME}/bin:${HOME}/bin \
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME}:${PYTHON_HOME}/bin:${HOME}/bin \
|
||||||
@@ -87,6 +84,6 @@ COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
|
|||||||
WORKDIR ${QL_DIR}
|
WORKDIR ${QL_DIR}
|
||||||
|
|
||||||
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
||||||
CMD curl -sf --noproxy '*' http://127.0.0.1:${QlPort:-5700}/api/health || exit 1
|
CMD curl -sf --noproxy '*' http://127.0.0.1:5700/api/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ log_with_style() {
|
|||||||
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fix DNS resolution issues in Alpine Linux (requires root)
|
# Fix DNS resolution issues in Alpine Linux
|
||||||
# Alpine uses musl libc which has known DNS resolver issues with certain domains
|
# Alpine uses musl libc which has known DNS resolver issues with certain domains
|
||||||
# Adding ndots:0 prevents unnecessary search domain appending
|
# Adding ndots:0 prevents unnecessary search domain appending
|
||||||
if [ "$(id -u)" = "0" ] && [ -f /etc/alpine-release ]; then
|
if [ -f /etc/alpine-release ]; then
|
||||||
if ! grep -q "^options ndots:0" /etc/resolv.conf 2>/dev/null; then
|
if ! grep -q "^options ndots:0" /etc/resolv.conf 2>/dev/null; then
|
||||||
echo "options ndots:0" >> /etc/resolv.conf
|
echo "options ndots:0" >> /etc/resolv.conf
|
||||||
log_with_style "INFO" "🔧 0. 已配置 DNS 解析优化 (ndots:0)"
|
log_with_style "INFO" "🔧 0. 已配置 DNS 解析优化 (ndots:0)"
|
||||||
@@ -50,11 +50,6 @@ fi
|
|||||||
|
|
||||||
log_with_style "SUCCESS" "🎉 容器启动成功!"
|
log_with_style "SUCCESS" "🎉 容器启动成功!"
|
||||||
|
|
||||||
if [ "$(id -u)" = "0" ]; then
|
|
||||||
crond -f >/dev/null
|
crond -f >/dev/null
|
||||||
else
|
|
||||||
# crond requires root in Alpine; keep container alive without it
|
|
||||||
exec tail -f /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"multer": "2.1.1",
|
"multer": "2.1.1",
|
||||||
"node-schedule": "^2.1.0",
|
"node-schedule": "^2.1.0",
|
||||||
"nodemailer": "^8.0.1",
|
"nodemailer": "^6.9.16",
|
||||||
"p-queue-cjs": "7.3.4",
|
"p-queue-cjs": "7.3.4",
|
||||||
"@bufbuild/protobuf": "^2.10.0",
|
"@bufbuild/protobuf": "^2.10.0",
|
||||||
"ps-tree": "^1.2.0",
|
"ps-tree": "^1.2.0",
|
||||||
|
|||||||
Generated
+4
-4
@@ -92,8 +92,8 @@ dependencies:
|
|||||||
specifier: ^2.1.0
|
specifier: ^2.1.0
|
||||||
version: 2.1.1
|
version: 2.1.1
|
||||||
nodemailer:
|
nodemailer:
|
||||||
specifier: ^8.0.1
|
specifier: ^6.9.16
|
||||||
version: 8.0.1
|
version: 6.9.16
|
||||||
p-queue-cjs:
|
p-queue-cjs:
|
||||||
specifier: 7.3.4
|
specifier: 7.3.4
|
||||||
version: 7.3.4
|
version: 7.3.4
|
||||||
@@ -10647,8 +10647,8 @@ packages:
|
|||||||
sorted-array-functions: 1.3.0
|
sorted-array-functions: 1.3.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/nodemailer@8.0.1:
|
/nodemailer@6.9.16:
|
||||||
resolution: {integrity: sha512-5kcldIXmaEjZcHR6F28IKGSgpmZHaF1IXLWFTG+Xh3S+Cce4MiakLtWY+PlBU69fLbRa8HlaGIrC/QolUpHkhg==}
|
resolution: {integrity: sha512-psAuZdTIRN08HKVd/E8ObdV6NO7NTBY3KsC30F7M4H1OnmLCUNaS56FpYxyb26zWLSyYF9Ozch9KYHhHegsiOQ==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ run_normal() {
|
|||||||
if [[ ${file_param} != /* ]] && [[ ! -z ${relative_path} ]] && [[ ${file_param} =~ "/" ]]; then
|
if [[ ${file_param} != /* ]] && [[ ! -z ${relative_path} ]] && [[ ${file_param} =~ "/" ]]; then
|
||||||
cd ${relative_path}
|
cd ${relative_path}
|
||||||
file_param=${file_param/$relative_path\//}
|
file_param=${file_param/$relative_path\//}
|
||||||
|
elif [[ ${file_param} == /* ]] && [[ ! -z ${relative_path} ]]; then
|
||||||
|
cd ${relative_path}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $isJsOrPythonFile == 'false' ]]; then
|
if [[ $isJsOrPythonFile == 'false' ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user