refactor: Replace Dockerfile with Dockerfile.fast for faster builds and add Dockerfile.test for testing purposes
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 5m40s

This commit is contained in:
2025-07-08 23:54:18 +07:00
parent 97711f26cb
commit 82f2d62bf8
6 changed files with 21 additions and 2513 deletions
+1 -3
View File
@@ -18,7 +18,6 @@ jobs:
with:
driver-opts: |
image=moby/buildkit:v0.12.0
network=host
- name: Log in to Gitea Registry
uses: docker/login-action@v3
@@ -46,5 +45,4 @@ jobs:
org.opencontainers.image.revision=${{ gitea.sha }}
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
build-args: |
BUILDKIT_INLINE_CACHE=1
BUILDKIT_PROGRESS=plain
BUILDKIT_INLINE_CACHE=1
@@ -1,47 +0,0 @@
name: Publish Tabler Docker image
on:
push:
branches:
- tabler
jobs:
build-and-push-tabler:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:v0.12.0
- name: Log in to Gitea Registry
uses: docker/login-action@v3
with:
registry: git.shts.su
username: ${{ gitea.actor }}
password: ${{ secrets.ACTIONS_PAT }}
- name: Build and push Tabler Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
git.shts.su/${{ gitea.repository }}:tabler
git.shts.su/${{ gitea.repository }}:tabler-${{ gitea.sha }}
labels: |
org.opencontainers.image.title=S3 Lists Manager with Tabler UI
org.opencontainers.image.description=Modern S3 Lists Manager with Tabler UI design
org.opencontainers.image.version=tabler
org.opencontainers.image.revision=${{ gitea.sha }}
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
build-args: |
BUILDKIT_INLINE_CACHE=1
+6 -6
View File
@@ -16,8 +16,11 @@
# Основной оптимизированный
docker build -f Dockerfile .
# Быстрый с Yarn
# Быстрый с Alpine
docker build -f Dockerfile.fast .
# Простой тестовый
docker build -f Dockerfile.test .
```
#### B. Проверить сетевые настройки
@@ -64,12 +67,9 @@ cache-to: type=gha,mode=max
git push origin tabler
```
### Вариант 2: Быстрый с Yarn
### Вариант 2: Быстрый с Alpine
```bash
# Переименовать Dockerfile.fast в Dockerfile
mv Dockerfile.fast Dockerfile
git add Dockerfile
git commit -m "Switch to fast Dockerfile"
# Использовать Dockerfile.fast (уже исправлен)
git push origin tabler
```
-47
View File
@@ -1,47 +0,0 @@
# Stage 1: Build React frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
# Set npm config for better performance
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
# Copy package files first for better caching
COPY frontend/package*.json ./
# Install dependencies with specific flags
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy source code
COPY frontend/ .
# Build the application
RUN npm run build
# Stage 2: Setup Node.js backend and serve everything
FROM node:20-slim
WORKDIR /app
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
# Copy package files first for better caching
COPY backend/package*.json ./
# Install production dependencies only
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy backend source code
COPY backend/ .
# Copy built frontend assets from the previous stage
COPY --from=frontend-builder /app/frontend/dist ./public
# The port the backend runs on
EXPOSE 3001
# Start the server
CMD ["node", "server.js"]
+14 -12
View File
@@ -2,35 +2,37 @@
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Install yarn for faster package management
RUN npm install -g yarn
# Set npm config for better performance
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
# Copy package files
# Copy package files first for better caching
COPY frontend/package*.json ./
COPY frontend/yarn.lock* ./
# Install dependencies with yarn (faster than npm)
RUN yarn install --frozen-lockfile --network-timeout 300000
# Install dependencies with specific flags for speed
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy source code
COPY frontend/ .
# Build the application
RUN yarn build
RUN npm run build
# Stage 2: Setup Node.js backend and serve everything
FROM node:20-alpine
WORKDIR /app
# Install yarn for faster package management
RUN npm install -g yarn
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
# Copy package files
# Copy package files first for better caching
COPY backend/package*.json ./
COPY backend/yarn.lock* ./
# Install production dependencies only
RUN yarn install --frozen-lockfile --production --network-timeout 300000
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy backend source code
COPY backend/ .
-2398
View File
File diff suppressed because it is too large Load Diff