support docker

This commit is contained in:
musistudio
2025-12-25 23:00:24 +08:00
parent 6a20b2021d
commit cd7454d7fb
25 changed files with 541 additions and 206 deletions

View File

@@ -7,18 +7,27 @@ const fs = require('fs');
console.log('Building Server package...');
try {
const serverDir = path.join(__dirname, '../packages/server');
// Create dist directory
const distDir = path.join(__dirname, '../packages/server/dist');
const distDir = path.join(serverDir, 'dist');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
}
// Generate type declaration files
console.log('Generating type declaration files...');
execSync('tsc --emitDeclarationOnly', {
stdio: 'inherit',
cwd: serverDir
});
// Build the server application
console.log('Building server application...');
// 使用 minify 和 tree-shaking 优化体积
execSync('esbuild src/index.ts --bundle --platform=node --minify --tree-shaking=true --outfile=dist/index.js', {
stdio: 'inherit',
cwd: path.join(__dirname, '../packages/server')
cwd: serverDir
});
// Copy the tiktoken WASM file