Files
Charon/tools/dockerfile_check.sh
GitHub Actions 3169b05156 fix: skip incomplete system log viewer tests
- Marked 12 tests as skip pending feature implementation
- Features tracked in GitHub issue #686 (system log viewer feature completion)
- Tests cover sorting by timestamp/level/method/URI/status, pagination controls, filtering by text/level, download functionality
- Unblocks Phase 2 at 91.7% pass rate to proceed to Phase 3 security enforcement validation
- TODO comments in code reference GitHub #686 for feature completion tracking
- Tests skipped: Pagination (3), Search/Filter (2), Download (2), Sorting (1), Log Display (4)
2026-02-09 21:55:55 +00:00

56 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Dockerfile validation script
# Checks for common mismatches between base images and package managers
set -e
DOCKERFILE="${1:-Dockerfile}"
if [ ! -f "$DOCKERFILE" ]; then
echo "Error: $DOCKERFILE not found"
exit 1
fi
echo "Checking $DOCKERFILE for base image / package manager mismatches..."
checking_stage=false
current_stage=""
stage_base=""
while IFS= read -r line; do
if echo "$line" | grep -qE "^FROM\s+"; then
checking_stage=true
current_stage="$line"
stage_base="unknown"
if echo "$line" | grep -qi "alpine"; then
stage_base="alpine"
elif echo "$line" | grep -qiE "debian|ubuntu|trixie|bookworm|bullseye"; then
stage_base="debian"
fi
fi
if [ "$checking_stage" = true ] && [ "$stage_base" = "alpine" ]; then
if echo "$line" | grep -qE "(apt-get|apt)\s+(install|update)" || echo "$line" | grep -qE "xx-apt\s+"; then
echo "❌ ERROR: Found Alpine-based image with Debian package manager (apt/apt-get)"
echo " Stage: $current_stage"
echo " Command: $line"
echo " Fix: Use 'apk add' or 'xx-apk' instead"
exit 1
fi
fi
if [ "$checking_stage" = true ] && [ "$stage_base" = "debian" ]; then
if echo "$line" | grep -qE "apk\s+(add|update|del)" || echo "$line" | grep -qE "xx-apk\s+"; then
echo "❌ ERROR: Found Debian-based image with Alpine package manager (apk)"
echo " Stage: $current_stage"
echo " Command: $line"
echo " Fix: Use 'apt-get' or 'xx-apt' instead"
exit 1
fi
fi
done < "$DOCKERFILE"
echo "✓ Dockerfile validation passed"
exit 0