feat: Update Docker configuration and enhance AutoUrlManager with copy functionality for example format
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 4m32s

This commit is contained in:
2025-08-08 08:18:32 +07:00
parent d96f1e1c24
commit b0094e4658
4 changed files with 117 additions and 91 deletions
+25 -59
View File
@@ -1,69 +1,35 @@
# Dependencies
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Production builds
frontend/dist
frontend/build
# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# IDE files
.vscode
.idea
*.swp
*.swo
# OS files
.DS_Store
Thumbs.db
# Git
# VCS
.git
.gitattributes
.gitignore
# Documentation
README.md
CHANGELOG.md
DOCKER.md
# CI config (excluded from build context)
.gitea/
# CI/CD
.gitea
# Node modules
node_modules/
frontend/node_modules/
backend/node_modules/
# IDE/OS
.vscode/
.idea/
.DS_Store
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Frontend build output
frontend/dist/
# Coverage directory used by tools like istanbul
coverage
# Large example data not needed for image build
example/
example-servers*.json
# nyc test coverage
.nyc_output
# Dependency directories
jspm_packages/
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Misc docs
Dockerfile*
README.md
CHANGELOG.md
CI_TROUBLESHOOTING.md
DOCKER.md
SHX_NETWORK.md
+9 -4
View File
@@ -12,12 +12,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:v0.12.0
image=moby/buildkit:v0.13.2
- name: Log in to Gitea Registry
uses: docker/login-action@v3
@@ -33,8 +35,10 @@ jobs:
file: ./Dockerfile.fast
push: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: |
type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast-buildcache
type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast
cache-to: type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast-buildcache,mode=max
tags: |
git.shts.su/${{ gitea.repository }}:tabler-fast
git.shts.su/${{ gitea.repository }}:tabler-fast-${{ gitea.sha }}
@@ -45,4 +49,5 @@ jobs:
org.opencontainers.image.revision=${{ gitea.sha }}
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
build-args: |
BUILDKIT_INLINE_CACHE=1
BUILDKIT_INLINE_CACHE=1
provenance: false
+12 -15
View File
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.6
# Stage 1: Build React frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
@@ -5,19 +6,17 @@ WORKDIR /app/frontend
# Install build dependencies for native modules
RUN apk add --no-cache python3 make g++
# Set npm config for better performance and caching
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
RUN npm config set fetch-retry-mintimeout 20000
RUN npm config set fetch-retry-maxtimeout 120000
RUN npm config set cache /tmp/.npm
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/ \
&& npm config set fetch-timeout 300000 \
&& npm config set fetch-retry-mintimeout 20000 \
&& npm config set fetch-retry-maxtimeout 120000
# Copy package files first for better caching
COPY frontend/package*.json ./
# Clean install dependencies to fix rollup issue with optimized flags
RUN rm -rf node_modules package-lock.json
RUN npm install --no-audit --no-fund --prefer-offline --build-from-source --production=false --cache /tmp/.npm
# Clean install dependencies with lockfile for reproducible and cached builds
RUN --mount=type=cache,target=/root/.npm npm ci --no-audit --no-fund
# Copy source code (only what's needed for build)
COPY frontend/src/ ./src/
@@ -33,20 +32,18 @@ RUN npm run build
FROM node:20-alpine
WORKDIR /app
# Set npm config for better performance and caching
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
RUN npm config set cache /tmp/.npm
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/ \
&& npm config set fetch-timeout 300000
# Copy package files first for better caching
COPY backend/package*.json ./
# Install production dependencies only with optimized flags
RUN npm ci --only=production --no-audit --no-fund --prefer-offline --cache /tmp/.npm
RUN --mount=type=cache,target=/root/.npm npm ci --only=production --no-audit --no-fund
# Copy backend source code (only what's needed)
COPY backend/server.js ./
COPY backend/package.json ./
# Copy built frontend assets from the previous stage
COPY --from=frontend-builder /app/frontend/dist ./public
+71 -13
View File
@@ -9,7 +9,9 @@ import {
IconLoader,
IconUpload,
IconDeviceFloppy,
IconInfoCircle
IconInfoCircle,
IconCircleCheck,
IconCopy
} from '@tabler/icons-react';
function AutoUrlManager() {
@@ -119,6 +121,29 @@ function AutoUrlManager() {
}
};
const copyExample = async () => {
const text = 'https://test.com/ips.txt 555\nhttps://example.com/blacklist.txt 666';
try {
if (navigator.clipboard) {
await navigator.clipboard.writeText(text);
} else {
const ta = document.createElement('textarea');
ta.value = text;
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
document.body.removeChild(ta);
}
setMessage('Пример формата скопирован');
setMessageType('success');
setTimeout(() => setMessage(''), 2000);
} catch (e) {
setMessage('Не удалось скопировать пример');
setMessageType('error');
setTimeout(() => setMessage(''), 2000);
}
};
if (loading) {
return (
<div className="d-flex justify-content-center align-items-center" style={{ minHeight: '200px' }}>
@@ -327,22 +352,55 @@ function AutoUrlManager() {
<h3 className="card-title"><IconInfoCircle className="me-2" />Информация</h3>
</div>
<div className="card-body">
<div className="row">
<div className="row g-4">
<div className="col-md-6">
<h4>Как это работает:</h4>
<ul>
<li>Добавьте URL-адреса, которые содержат списки IP-адресов</li>
<li>Укажите community для каждого URL</li>
<li>Нажмите "Загрузить IP-списки" для обработки всех URL</li>
<li>IP-адреса будут добавлены в файл bgp_data/ips.txt</li>
<h4 className="mb-3">Как это работает</h4>
<ul className="list-unstyled m-0">
<li className="d-flex align-items-start mb-2">
<span className="text-blue me-2"><IconCircleCheck size={18} /></span>
<span>Добавьте URL-адреса, которые содержат списки IP-адресов</span>
</li>
<li className="d-flex align-items-start mb-2">
<span className="text-blue me-2"><IconCircleCheck size={18} /></span>
<span>Укажите community для каждого URL (только цифры)</span>
</li>
<li className="d-flex align-items-start mb-2">
<span className="text-blue me-2"><IconCircleCheck size={18} /></span>
<span>Нажмите «Загрузить IP-списки» для обработки всех URL</span>
</li>
<li className="d-flex align-items-start">
<span className="text-blue me-2"><IconCircleCheck size={18} /></span>
<span>IP-адреса будут добавлены в файл <code>bgp_data/ips.txt</code></span>
</li>
</ul>
</div>
<div className="col-md-6">
<h4>Формат файла:</h4>
<p>Файл сохраняется в формате:</p>
<pre className="bg-light p-2 rounded">
{`https://test.com/ips.txt 555\nhttps://example.com/blacklist.txt 666`}
</pre>
<h4 className="mb-3">Формат файла</h4>
<div className="card card-sm">
<div className="card-header">
<h3 className="card-title">Пример</h3>
<div className="card-actions">
<button className="btn btn-outline-secondary btn-sm" onClick={copyExample}>
<IconCopy className="me-1" />
Копировать
</button>
</div>
</div>
<div className="card-body">
<pre
className="m-0 p-2 bg-dark text-light rounded"
style={{
fontFamily:
"ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace",
fontSize: '0.875rem',
overflow: 'auto'
}}
>
<code>{`https://test.com/ips.txt 555\nhttps://example.com/blacklist.txt 666`}</code>
</pre>
<div className="text-muted small mt-2">Каждая строка: URL и community через пробел</div>
</div>
</div>
</div>
</div>
</div>