add .drone.yml
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 17:24:47 +08:00
parent aaa484ebee
commit 986be675b2
2 changed files with 75 additions and 0 deletions

73
.drone.yml Normal file
View File

@@ -0,0 +1,73 @@
---
kind: pipeline
type: docker
name: learn-languages
platform:
os: linux
arch: amd64
volumes:
- name: debian-dist
host:
path: /home/debian/dist
steps:
- name: build
image: node:23-alpine
commands:
- npm ci
- npm run build
- name: package
image: node:23-alpine
environment:
ZHIPU_API_KEY:
from_secret: zhipu_api_key
commands:
- apk add zip
- mkdir -p .next/standalone/.next
- cp -r public .next/standalone
- cp -r .next/static .next/standalone/.next
- cd .next/standalone
- echo "$ZHIPU_API_KEY" > zhipu_api_key.txt
- rm -f /dist/learn-languages.zip
- zip -r /dist/learn-languages.zip .
volumes:
- name: debian-dist
path: /dist
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
password:
from_secret: ssh_password
port: 22
script:
- cd ~/
- rm -rf learn-languages
- mkdir learn-languages
- unzip -d learn-languages dist/learn-languages.zip
- cd learn-languages
- npm i
- |
if pm2 list | grep -q learn-languages; then
echo "进程 learn-languages 已在pm2中运行正在重启..."
ZHIPU_API_KEY=`cat zhipu_api_key.txt` PORT=3030 pm2 restart "learn-languages"
else
echo "进程 learn-languages 未在pm2中运行正在启动..."
ZHIPU_API_KEY=`cat zhipu_api_key.txt` PORT=3030 pm2 start "./server.js" --name "learn-languages"
fi
- pm2 save
- cd ~/
- rm -rf dist
- mkdir dist
debug: true
trigger:
branch:
- main

View File

@@ -2,6 +2,8 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
output: "standalone",
allowedDevOrigins: ["192.168.3.65"]
};
export default nextConfig;