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
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 5m40s
This commit is contained in:
@@ -18,7 +18,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
image=moby/buildkit:v0.12.0
|
image=moby/buildkit:v0.12.0
|
||||||
network=host
|
|
||||||
|
|
||||||
- name: Log in to Gitea Registry
|
- name: Log in to Gitea Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -46,5 +45,4 @@ 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
|
||||||
BUILDKIT_PROGRESS=plain
|
|
||||||
@@ -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
|
|
||||||
@@ -16,8 +16,11 @@
|
|||||||
# Основной оптимизированный
|
# Основной оптимизированный
|
||||||
docker build -f Dockerfile .
|
docker build -f Dockerfile .
|
||||||
|
|
||||||
# Быстрый с Yarn
|
# Быстрый с Alpine
|
||||||
docker build -f Dockerfile.fast .
|
docker build -f Dockerfile.fast .
|
||||||
|
|
||||||
|
# Простой тестовый
|
||||||
|
docker build -f Dockerfile.test .
|
||||||
```
|
```
|
||||||
|
|
||||||
#### B. Проверить сетевые настройки
|
#### B. Проверить сетевые настройки
|
||||||
@@ -64,12 +67,9 @@ cache-to: type=gha,mode=max
|
|||||||
git push origin tabler
|
git push origin tabler
|
||||||
```
|
```
|
||||||
|
|
||||||
### Вариант 2: Быстрый с Yarn
|
### Вариант 2: Быстрый с Alpine
|
||||||
```bash
|
```bash
|
||||||
# Переименовать Dockerfile.fast в Dockerfile
|
# Использовать Dockerfile.fast (уже исправлен)
|
||||||
mv Dockerfile.fast Dockerfile
|
|
||||||
git add Dockerfile
|
|
||||||
git commit -m "Switch to fast Dockerfile"
|
|
||||||
git push origin tabler
|
git push origin tabler
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
-47
@@ -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
@@ -2,35 +2,37 @@
|
|||||||
FROM node:20-alpine AS frontend-builder
|
FROM node:20-alpine AS frontend-builder
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
# Install yarn for faster package management
|
# Set npm config for better performance
|
||||||
RUN npm install -g yarn
|
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/package*.json ./
|
||||||
COPY frontend/yarn.lock* ./
|
|
||||||
|
|
||||||
# Install dependencies with yarn (faster than npm)
|
# Install dependencies with specific flags for speed
|
||||||
RUN yarn install --frozen-lockfile --network-timeout 300000
|
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY frontend/ .
|
COPY frontend/ .
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN yarn build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 2: Setup Node.js backend and serve everything
|
# Stage 2: Setup Node.js backend and serve everything
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install yarn for faster package management
|
# Set npm config for better performance
|
||||||
RUN npm install -g yarn
|
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/package*.json ./
|
||||||
COPY backend/yarn.lock* ./
|
|
||||||
|
|
||||||
# Install production dependencies only
|
# 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 source code
|
||||||
COPY backend/ .
|
COPY backend/ .
|
||||||
|
|||||||
Generated
-2398
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user