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'