Add CI check for missing workspace packages in Dockerfiles
Adds a script that verifies every packages/*/package.json is listed in all app Dockerfiles. Catches the recurring issue where adding a new workspace package breaks production because the Dockerfile deps stage doesn't know about it. Also fixes two pre-existing missing packages in the planner Dockerfile (api, map-core) caught by the new check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fe57a690c0
commit
7c207a2a98
3 changed files with 36 additions and 0 deletions
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
|
|
@ -38,6 +38,13 @@ jobs:
|
|||
run: pnpm audit --audit-level=high
|
||||
continue-on-error: true
|
||||
|
||||
dockerfile-check:
|
||||
name: Dockerfile Package Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- run: bash scripts/check-dockerfiles.sh
|
||||
|
||||
typecheck:
|
||||
name: Typecheck
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ COPY packages/ui/package.json packages/ui/
|
|||
COPY packages/map/package.json packages/map/
|
||||
COPY packages/gpx/package.json packages/gpx/
|
||||
COPY packages/i18n/package.json packages/i18n/
|
||||
COPY packages/api/package.json packages/api/
|
||||
COPY packages/map-core/package.json packages/map-core/
|
||||
COPY packages/db/package.json packages/db/
|
||||
COPY packages/jobs/package.json packages/jobs/
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
|
|
|||
27
scripts/check-dockerfiles.sh
Executable file
27
scripts/check-dockerfiles.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Verify all workspace packages are listed in Dockerfiles.
|
||||
# Run in CI to catch missing COPY lines when new packages are added.
|
||||
set -euo pipefail
|
||||
|
||||
errors=0
|
||||
|
||||
for pkg_json in packages/*/package.json; do
|
||||
pkg_dir=$(dirname "$pkg_json") # e.g. packages/jobs
|
||||
pkg_name=$(basename "$pkg_dir") # e.g. jobs
|
||||
|
||||
for dockerfile in apps/*/Dockerfile; do
|
||||
app=$(basename "$(dirname "$dockerfile")")
|
||||
if ! grep -q "COPY ${pkg_dir}/package.json" "$dockerfile"; then
|
||||
echo "ERROR: $dockerfile is missing COPY for $pkg_dir/package.json"
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$errors" -gt 0 ]; then
|
||||
echo ""
|
||||
echo "$errors missing package(s) in Dockerfiles. Add COPY lines to the deps stage."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All workspace packages present in all Dockerfiles."
|
||||
Loading…
Add table
Add a link
Reference in a new issue