- Add Dockerfile.fast with cargo-chef and symbol stripping - Add Dockerfile.superfast using pre-built base image - Add Dockerfile.base for dependency caching - Update Woodpecker with registry cache (cache_from/cache_to) - Add fast-build.sh for local ultra-fast builds - Add build-base-image.sh for one-time dependency build - Enable BuildKit layer caching in CI
78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
when:
|
|
branch: [main, high-performance]
|
|
event: push
|
|
|
|
matrix:
|
|
SERVICE:
|
|
- gateway
|
|
- users
|
|
- companies
|
|
- job_seekers
|
|
- customers
|
|
- payments
|
|
- employees
|
|
- photographers
|
|
- makeup_artists
|
|
- tutors
|
|
- developers
|
|
- video_editors
|
|
- graphic_designers
|
|
- social_media_managers
|
|
- fitness_trainers
|
|
- catering_services
|
|
- ugc_content_creators
|
|
- cron
|
|
|
|
steps:
|
|
- name: detect-changes
|
|
image: alpine/git
|
|
commands:
|
|
- apk add --no-cache bash
|
|
- |
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD || echo "")
|
|
SERVICE_PATH=$(echo "${SERVICE}" | tr '_' '-')
|
|
|
|
SHARED_CHANGED=false
|
|
if echo "$CHANGED_FILES" | grep -q "^crates/"; then
|
|
SHARED_CHANGED=true
|
|
echo "⚠️ Shared crates changed"
|
|
fi
|
|
|
|
SERVICE_CHANGED=false
|
|
if echo "$CHANGED_FILES" | grep -q "^apps/${SERVICE_PATH}/"; then
|
|
SERVICE_CHANGED=true
|
|
echo "✅ Service ${SERVICE} changed"
|
|
fi
|
|
|
|
if [ "$SHARED_CHANGED" = "true" ] || [ "$SERVICE_CHANGED" = "true" ]; then
|
|
echo "🚀 Building ${SERVICE}"
|
|
exit 0
|
|
else
|
|
echo "⏭️ Skipping ${SERVICE}"
|
|
exit 78
|
|
fi
|
|
|
|
- name: build-and-push
|
|
image: woodpeckerci/plugin-docker-buildx:5.0.0
|
|
settings:
|
|
registry: ghcr.io
|
|
repo: ghcr.io/traceworks2023/nxtgauge-rust-${SERVICE}
|
|
context: .
|
|
dockerfile: Dockerfile.fast
|
|
build_args:
|
|
- SERVICE_NAME=${SERVICE}
|
|
tags:
|
|
- ${CI_COMMIT_SHA}
|
|
- latest
|
|
- high-performance-latest
|
|
username:
|
|
from_secret: GHCR_USERNAME
|
|
password:
|
|
from_secret: GHCR_TOKEN
|
|
platforms: linux/amd64
|
|
# ENABLE CACHE - This is the key!
|
|
cache_from: ghcr.io/traceworks2023/nxtgauge-rust-${SERVICE}:cache
|
|
cache_to: ghcr.io/traceworks2023/nxtgauge-rust-${SERVICE}:cache
|