diff --git a/Dockerfile b/Dockerfile index ad3ef44..5c5f6a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,11 +19,16 @@ ENV HOSTNAME=0.0.0.0 RUN addgroup --system --gid 1001 nodejs && \ adduser --system --uid 1001 nextjs +# Standalone-сборка COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -RUN mkdir -p /app/uploads && chown nextjs:nodejs /app/uploads +# SQLite: схема для инициализации БД при первом запуске +COPY --from=builder --chown=nextjs:nodejs /app/init ./init + +# Директория для SQLite БД и загрузок (монтируется через volume) +RUN mkdir -p /app/data /app/uploads && chown nextjs:nodejs /app/data /app/uploads USER nextjs diff --git a/next.config.js b/next.config.js index a0bd60a..9d6fba5 100644 --- a/next.config.js +++ b/next.config.js @@ -5,6 +5,9 @@ const nextConfig = { eslint: { ignoreDuringBuilds: true, }, + compiler: { + styledComponents: true, + }, } module.exports = nextConfig diff --git a/package.json b/package.json index 1793f0a..cbc21e5 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,10 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "next start", + "start": "node .next/standalone/server.js", + "preview": "npm run build && node .next/standalone/server.js", "lint": "next lint", - "postbuild": "next-sitemap" + "postbuild": "next-sitemap && node scripts/copy-standalone.js" }, "dependencies": { "bcrypt": "^6.0.0", diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml index c661ed0..97a26b3 100644 --- a/public/sitemap-0.xml +++ b/public/sitemap-0.xml @@ -1,11 +1,11 @@ -https://strike-arena.kz/admin/faq2026-06-02T13:00:15.241Zweekly0.7 -https://strike-arena.kz/admin/price2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz/admin/games2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz/admin/login2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz/admin/hardware2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz/admin/contacts2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz2026-06-02T13:00:15.242Zweekly0.7 -https://strike-arena.kz/policy2026-06-02T13:00:15.242Zweekly0.7 +https://strike-arena.kz/admin/contacts2026-06-02T17:07:25.971Zweekly0.7 +https://strike-arena.kz/admin/games2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz/admin/login2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz/admin/hardware2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz/admin/price2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz/admin/faq2026-06-02T17:07:25.972Zweekly0.7 +https://strike-arena.kz/policy2026-06-02T17:07:25.972Zweekly0.7 \ No newline at end of file diff --git a/scripts/copy-standalone.js b/scripts/copy-standalone.js new file mode 100644 index 0000000..e46477c --- /dev/null +++ b/scripts/copy-standalone.js @@ -0,0 +1,49 @@ +// Копирует нужные файлы в .next/standalone/ после билда +const fs = require('fs'); +const path = require('path'); + +function copyDir(src, dest) { + if (!fs.existsSync(src)) return; + fs.mkdirSync(dest, { recursive: true }); + for (const entry of fs.readdirSync(src, { withFileTypes: true })) { + const srcPath = path.join(src, entry.name); + const destPath = path.join(dest, entry.name); + if (entry.isDirectory()) { + copyDir(srcPath, destPath); + } else { + fs.copyFileSync(srcPath, destPath); + } + } +} + +function copyFile(src, dest) { + if (!fs.existsSync(src)) return; + fs.mkdirSync(path.dirname(dest), { recursive: true }); + fs.copyFileSync(src, dest); + console.log(` ✓ ${path.basename(src)}`); +} + +const root = path.join(__dirname, '..'); +const standalone = path.join(root, '.next', 'standalone'); + +console.log('Копирую файлы в .next/standalone/...'); + +// public/ → .next/standalone/public/ +copyDir(path.join(root, 'public'), path.join(standalone, 'public')); +console.log(' ✓ public/'); + +// .next/static/ → .next/standalone/.next/static/ +copyDir(path.join(root, '.next', 'static'), path.join(standalone, '.next', 'static')); +console.log(' ✓ .next/static/'); + +// init/ → .next/standalone/init/ (нужно для SQLite seed) +copyDir(path.join(root, 'init'), path.join(standalone, 'init')); +console.log(' ✓ init/'); + +// .env.local → .next/standalone/.env.local (переменные окружения для локального запуска) +copyFile(path.join(root, '.env.local'), path.join(standalone, '.env.local')); + +// .env → .next/standalone/.env (если есть) +copyFile(path.join(root, '.env'), path.join(standalone, '.env')); + +console.log('✓ standalone готов к запуску');