mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
Improve Docker build caching for staging workflow
- Add registry cache persistence to fallback when GHA cache expires - Optimize static-assets stage with selective COPY for frontend files - Reduces context from 44MB to 3.2MB, preventing cache invalidation on backend changes - Backend-only changes no longer trigger unnecessary frontend rebuilds
This commit is contained in:
parent
ad013ca7da
commit
b7a6f1a4fa
2 changed files with 19 additions and 3 deletions
4
.github/workflows/coolify-staging-build.yml
vendored
4
.github/workflows/coolify-staging-build.yml
vendored
|
|
@ -80,7 +80,9 @@ jobs:
|
|||
cache-from: |
|
||||
type=gha,scope=build-${{ matrix.arch }}
|
||||
type=registry,ref=${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
|
||||
cache-to: |
|
||||
type=gha,mode=max,scope=build-${{ matrix.arch }}
|
||||
type=registry,ref=${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.arch }},mode=max
|
||||
|
||||
merge-manifest:
|
||||
runs-on: ubuntu-24.04
|
||||
|
|
|
|||
|
|
@ -38,10 +38,24 @@ USER www-data
|
|||
FROM node:24-alpine AS static-assets
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json vite.config.js postcss.config.cjs ./
|
||||
|
||||
# Layer 1: Package dependencies (rarely changes)
|
||||
COPY package*.json ./
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
COPY . .
|
||||
|
||||
# Layer 2: Build config (rarely changes)
|
||||
COPY vite.config.js postcss.config.cjs ./
|
||||
|
||||
# Layer 3: Frontend source files
|
||||
COPY resources/css/ ./resources/css/
|
||||
COPY resources/js/ ./resources/js/
|
||||
COPY resources/fonts/ ./resources/fonts/
|
||||
|
||||
# Layer 4: Blade templates for Tailwind class detection
|
||||
COPY resources/views/ ./resources/views/
|
||||
|
||||
# Build frontend assets
|
||||
RUN npm run build
|
||||
|
||||
# =================================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue