new build

This commit is contained in:
sbb45
2026-06-02 22:17:15 +05:00
parent 90ecfc669a
commit b0857cb01b
5 changed files with 69 additions and 11 deletions
+6 -1
View File
@@ -19,11 +19,16 @@ ENV HOSTNAME=0.0.0.0
RUN addgroup --system --gid 1001 nodejs && \ RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs adduser --system --uid 1001 nextjs
# Standalone-сборка
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static 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 USER nextjs
+3
View File
@@ -5,6 +5,9 @@ const nextConfig = {
eslint: { eslint: {
ignoreDuringBuilds: true, ignoreDuringBuilds: true,
}, },
compiler: {
styledComponents: true,
},
} }
module.exports = nextConfig module.exports = nextConfig
+3 -2
View File
@@ -5,9 +5,10 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "node .next/standalone/server.js",
"preview": "npm run build && node .next/standalone/server.js",
"lint": "next lint", "lint": "next lint",
"postbuild": "next-sitemap" "postbuild": "next-sitemap && node scripts/copy-standalone.js"
}, },
"dependencies": { "dependencies": {
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",
+8 -8
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://strike-arena.kz/admin/faq</loc><lastmod>2026-06-02T13:00:15.241Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/contacts</loc><lastmod>2026-06-02T17:07:25.971Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/admin/price</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/games</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/admin/games</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/login</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/admin/login</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/hardware</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/admin/hardware</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/price</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/admin/contacts</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/admin/faq</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://strike-arena.kz/policy</loc><lastmod>2026-06-02T13:00:15.242Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> <url><loc>https://strike-arena.kz/policy</loc><lastmod>2026-06-02T17:07:25.972Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
</urlset> </urlset>
+49
View File
@@ -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 готов к запуску');