- Create specialized toolbox container for auditing Docker images and related files - Include essential QA tools: Hadolint, Dive, ShellCheck, Trivy, Dockle, Docker client, Node.js - Implement comprehensive build, run, release, and test scripts - Add detailed documentation with usage examples - Ensure all tools work correctly within the container - Rename directory from toolbox-QADocker to toolbox-qadocker for consistency - Update QWEN.md with comprehensive QA workflow using toolbox-qadocker - Add mandatory pre-build audit process using QA tools - Add validation process for testing from inside container environment - Add comprehensive testing to verify all tools are working - Optimize Dockerfile for best practices and security - Ensure container runs as non-root user for security - Add release script for versioned releases to registry - Add test script to verify all tools are working correctly
69 lines
1.5 KiB
Bash
Executable File
69 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Build script for toolbox-qadocker
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Print colored output
|
|
print_status() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Default values
|
|
IMAGE_NAME="tsysdevstack-toolboxstack-toolbox-qadocker"
|
|
TAG="dev"
|
|
DOCKERFILE_PATH="Dockerfile"
|
|
|
|
# Parse command line arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--tag)
|
|
TAG="$2"
|
|
shift 2
|
|
;;
|
|
--file)
|
|
DOCKERFILE_PATH="$2"
|
|
shift 2
|
|
;;
|
|
--help)
|
|
echo "Usage: $0 [--tag TAG] [--file DOCKERFILE_PATH]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --tag TAG Specify the tag for the image (default: dev)"
|
|
echo " --file DOCKERFILE_PATH Specify the path to the Dockerfile (default: Dockerfile)"
|
|
echo " --help Show this help message"
|
|
exit 0
|
|
;;
|
|
*)
|
|
print_error "Unknown option: $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
IMAGE_TAGGED_NAME="${IMAGE_NAME}:${TAG}"
|
|
|
|
print_status "Building ${IMAGE_TAGGED_NAME}"
|
|
|
|
# Build the Docker image
|
|
docker build -t "${IMAGE_TAGGED_NAME}" -f "${DOCKERFILE_PATH}" .
|
|
|
|
if [ $? -eq 0 ]; then
|
|
print_status "Successfully built ${IMAGE_TAGGED_NAME}"
|
|
else
|
|
print_error "Failed to build ${IMAGE_TAGGED_NAME}"
|
|
exit 1
|
|
fi |