fix(docker): копирование apps/api/db.js и routes/ в образ; пути к web/dist и seed
- Dockerfile: добавлены COPY для db.js, routes/, apps/web/public (seed) - apps/api/index.js: distPath → ../web/dist (раньше ../dist) - apps/api/db/index.js: DB_PATH/SEED_DIR/dataDir — на 3 уровня вверх (apps/api/db/ → корень) и seed из apps/web/public/data Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -58,13 +58,16 @@ COPY --from=deps /app/packages/db/node_modules ./packages/db/node_modules
|
||||
COPY --from=build /app/apps/web/dist ./apps/web/dist
|
||||
COPY --from=build /app/apps/api/dist ./apps/api/dist
|
||||
COPY --from=build /app/apps/api/db ./apps/api/db
|
||||
COPY --from=build /app/apps/api/db.js ./apps/api/db.js
|
||||
COPY --from=build /app/apps/api/adapters ./apps/api/adapters
|
||||
COPY --from=build /app/apps/api/index.js ./apps/api/index.js
|
||||
COPY --from=build /app/apps/api/routes ./apps/api/routes
|
||||
COPY --from=build /app/apps/api/utils ./apps/api/utils
|
||||
COPY --from=build /app/apps/api/projects-service.js ./apps/api/projects-service.js
|
||||
COPY --from=build /app/apps/api/sync-scheduler.js ./apps/api/sync-scheduler.js
|
||||
COPY --from=build /app/apps/api/sync-account-job.js ./apps/api/sync-account-job.js
|
||||
COPY --from=build /app/apps/api/telegram.js ./apps/api/telegram.js
|
||||
COPY --from=build /app/apps/web/public ./apps/web/public
|
||||
EXPOSE 3001
|
||||
# Default runtime: legacy Express server (sync still pending migration to Fastify).
|
||||
# Set RUNTIME=fastify to use the new Fastify stack.
|
||||
|
||||
@@ -12,16 +12,16 @@ import { MIGRATIONS } from './migrations.js'
|
||||
import { seed, isDbEmpty } from './seed.js'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
// db/ is in server/, so .. = server, .. again = project root
|
||||
export const DB_PATH = join(__dirname, '..', '..', 'data', 'vps-tracker.db')
|
||||
const SEED_DIR = join(__dirname, '..', '..', 'public', 'data')
|
||||
// db/ is in apps/api/, so .. = apps/api, ../.. = apps, ../../.. = project root
|
||||
export const DB_PATH = join(__dirname, '..', '..', '..', 'data', 'vps-tracker.db')
|
||||
const SEED_DIR = join(__dirname, '..', '..', '..', 'apps', 'web', 'public', 'data')
|
||||
|
||||
let dbInstance = null
|
||||
/** @type {import('sql.js').SqlJsStatic | null} */
|
||||
let sqlJsFactory = null
|
||||
|
||||
export async function initDb() {
|
||||
const dataDir = join(__dirname, '..', '..', 'data')
|
||||
const dataDir = join(__dirname, '..', '..', '..', 'data')
|
||||
if (!existsSync(dataDir)) {
|
||||
mkdirSync(dataDir, { recursive: true })
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'url'
|
||||
import { initDb } from './db.js'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const distPath = join(__dirname, '..', 'dist')
|
||||
const distPath = join(__dirname, '..', 'web', 'dist')
|
||||
import dataRouter from './routes/data.js'
|
||||
import migrateRouter from './routes/migrate.js'
|
||||
import vpsRouter from './routes/vps.js'
|
||||
|
||||
Reference in New Issue
Block a user