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 # VCS
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
.git .git
.gitattributes
.gitignore .gitignore
# Documentation # CI config (excluded from build context)
README.md .gitea/
CHANGELOG.md
DOCKER.md
# CI/CD # Node modules
.gitea node_modules/
frontend/node_modules/
backend/node_modules/
# IDE/OS
.vscode/
.idea/
.DS_Store
# Logs # Logs
logs
*.log *.log
# Runtime data # Frontend build output
pids frontend/dist/
*.pid
*.seed
*.pid.lock
# Coverage directory used by tools like istanbul # Large example data not needed for image build
coverage example/
example-servers*.json
# nyc test coverage # Misc docs
.nyc_output Dockerfile*
README.md
# Dependency directories CHANGELOG.md
jspm_packages/ CI_TROUBLESHOOTING.md
DOCKER.md
# Optional npm cache directory SHX_NETWORK.md
.npm
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
+9 -4
View File
@@ -12,12 +12,14 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
driver-opts: | driver-opts: |
image=moby/buildkit:v0.12.0 image=moby/buildkit:v0.13.2
- name: Log in to Gitea Registry - name: Log in to Gitea Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -33,8 +35,10 @@ jobs:
file: ./Dockerfile.fast file: ./Dockerfile.fast
push: true push: true
platforms: linux/amd64 platforms: linux/amd64
cache-from: type=gha cache-from: |
cache-to: type=gha,mode=max 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: | tags: |
git.shts.su/${{ gitea.repository }}:tabler-fast git.shts.su/${{ gitea.repository }}:tabler-fast
git.shts.su/${{ gitea.repository }}:tabler-fast-${{ gitea.sha }} git.shts.su/${{ gitea.repository }}:tabler-fast-${{ gitea.sha }}
@@ -45,4 +49,5 @@ jobs:
org.opencontainers.image.revision=${{ gitea.sha }} org.opencontainers.image.revision=${{ gitea.sha }}
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }} org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
build-args: | 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 # Stage 1: Build React frontend
FROM node:20-alpine AS frontend-builder FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend WORKDIR /app/frontend
@@ -5,19 +6,17 @@ WORKDIR /app/frontend
# Install build dependencies for native modules # Install build dependencies for native modules
RUN apk add --no-cache python3 make g++ RUN apk add --no-cache python3 make g++
# Set npm config for better performance and caching # Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/ RUN npm config set registry https://registry.npmjs.org/ \
RUN npm config set fetch-timeout 300000 && npm config set fetch-timeout 300000 \
RUN npm config set fetch-retry-mintimeout 20000 && npm config set fetch-retry-mintimeout 20000 \
RUN npm config set fetch-retry-maxtimeout 120000 && npm config set fetch-retry-maxtimeout 120000
RUN npm config set cache /tmp/.npm
# Copy package files first for better caching # Copy package files first for better caching
COPY frontend/package*.json ./ COPY frontend/package*.json ./
# Clean install dependencies to fix rollup issue with optimized flags # Clean install dependencies with lockfile for reproducible and cached builds
RUN rm -rf node_modules package-lock.json RUN --mount=type=cache,target=/root/.npm npm ci --no-audit --no-fund
RUN npm install --no-audit --no-fund --prefer-offline --build-from-source --production=false --cache /tmp/.npm
# Copy source code (only what's needed for build) # Copy source code (only what's needed for build)
COPY frontend/src/ ./src/ COPY frontend/src/ ./src/
@@ -33,20 +32,18 @@ RUN npm run build
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
# Set npm config for better performance and caching # Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/ RUN npm config set registry https://registry.npmjs.org/ \
RUN npm config set fetch-timeout 300000 && npm config set fetch-timeout 300000
RUN npm config set cache /tmp/.npm
# Copy package files first for better caching # Copy package files first for better caching
COPY backend/package*.json ./ COPY backend/package*.json ./
# Install production dependencies only with optimized flags # 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 source code (only what's needed)
COPY backend/server.js ./ COPY backend/server.js ./
COPY backend/package.json ./
# Copy built frontend assets from the previous stage # Copy built frontend assets from the previous stage
COPY --from=frontend-builder /app/frontend/dist ./public COPY --from=frontend-builder /app/frontend/dist ./public
+71 -13
View File
@@ -9,7 +9,9 @@ import {
IconLoader, IconLoader,
IconUpload, IconUpload,
IconDeviceFloppy, IconDeviceFloppy,
IconInfoCircle IconInfoCircle,
IconCircleCheck,
IconCopy
} from '@tabler/icons-react'; } from '@tabler/icons-react';
function AutoUrlManager() { 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) { if (loading) {
return ( return (
<div className="d-flex justify-content-center align-items-center" style={{ minHeight: '200px' }}> <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> <h3 className="card-title"><IconInfoCircle className="me-2" />Информация</h3>
</div> </div>
<div className="card-body"> <div className="card-body">
<div className="row"> <div className="row g-4">
<div className="col-md-6"> <div className="col-md-6">
<h4>Как это работает:</h4> <h4 className="mb-3">Как это работает</h4>
<ul> <ul className="list-unstyled m-0">
<li>Добавьте URL-адреса, которые содержат списки IP-адресов</li> <li className="d-flex align-items-start mb-2">
<li>Укажите community для каждого URL</li> <span className="text-blue me-2"><IconCircleCheck size={18} /></span>
<li>Нажмите "Загрузить IP-списки" для обработки всех URL</li> <span>Добавьте URL-адреса, которые содержат списки IP-адресов</span>
<li>IP-адреса будут добавлены в файл bgp_data/ips.txt</li> </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> </ul>
</div> </div>
<div className="col-md-6"> <div className="col-md-6">
<h4>Формат файла:</h4> <h4 className="mb-3">Формат файла</h4>
<p>Файл сохраняется в формате:</p> <div className="card card-sm">
<pre className="bg-light p-2 rounded"> <div className="card-header">
{`https://test.com/ips.txt 555\nhttps://example.com/blacklist.txt 666`} <h3 className="card-title">Пример</h3>
</pre> <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> </div>
</div> </div>