From 3026f1d1cee9add3d40514cfa400c426c20b6446 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Fri, 26 Jun 2026 13:51:19 +0700 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=D0=BA=D0=BE=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20apps/api/db.js=20=D0=B8?= =?UTF-8?q?=20routes/=20=D0=B2=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B7;=20=D0=BF?= =?UTF-8?q?=D1=83=D1=82=D0=B8=20=D0=BA=20web/dist=20=D0=B8=20seed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Dockerfile | 3 +++ apps/api/db/index.js | 8 ++++---- apps/api/index.js | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8e27ad..d5f85f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. diff --git a/apps/api/db/index.js b/apps/api/db/index.js index 0513dd8..43f8a88 100644 --- a/apps/api/db/index.js +++ b/apps/api/db/index.js @@ -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 }) } diff --git a/apps/api/index.js b/apps/api/index.js index 99353af..0ef04b3 100644 --- a/apps/api/index.js +++ b/apps/api/index.js @@ -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'