feat(docker): add shared NestJS builder base image

- Add docker/Dockerfile.nestjs-base with all shared packages pre-built
- Convert 6 backend Dockerfiles (chat, todo, calendar, clock, contacts,
  mukke) to inherit from nestjs-base:local
- Fix bugs: duplicate shared-nestjs-setup builds (mukke), unnecessary
  shared-error-tracking rebuild in production stage (chat, clock)
- CD pipeline builds base image before services when backends deploy
- Net reduction: 317 lines removed, 112 added (-205 lines)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-21 10:48:31 +01:00
parent df2bf9ecb0
commit 683a4c5331
8 changed files with 112 additions and 317 deletions

View file

@ -217,6 +217,30 @@ jobs:
echo "deploy-all=false" >> $GITHUB_OUTPUT
echo "Services to deploy: $SERVICES"
- name: Build shared base image
run: |
cd "${{ env.PROJECT_DIR }}"
SERVICES="${{ steps.services.outputs.services }}"
DEPLOY_ALL="${{ steps.services.outputs.deploy-all }}"
# Check if any backend service is being deployed
NEEDS_BASE=false
if [ "$DEPLOY_ALL" == "true" ]; then
NEEDS_BASE=true
else
for svc in $SERVICES; do
case "$svc" in *-backend) NEEDS_BASE=true; break ;; esac
done
fi
if [ "$NEEDS_BASE" == "true" ]; then
echo "=== Building shared NestJS base image ==="
docker build -f docker/Dockerfile.nestjs-base -t nestjs-base:local . 2>&1 | tail -5
echo "Base image built"
else
echo "No backends to deploy, skipping base image"
fi
- name: Build and deploy services
id: build
run: |