feat: Introduce multi-architecture Alpine Docker images with NVM, Bun, and Deno support
This commit is contained in:
83
test-alpine-images.sh
Executable file
83
test-alpine-images.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🧪 Testing Multi-Architecture Alpine Docker Images"
|
||||
echo "==================================================="
|
||||
echo ""
|
||||
|
||||
# Color codes
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
FAILED_TESTS=0
|
||||
|
||||
# Test function
|
||||
test_image() {
|
||||
local tag=$1
|
||||
local description=$2
|
||||
local test_cmd=$3
|
||||
|
||||
echo -e "${BLUE}🧪 Testing: ${NC}${description}"
|
||||
echo -e "${YELLOW} Tag: ${NC}${tag}"
|
||||
|
||||
if docker run --rm "${tag}" bash -c "${test_cmd}"; then
|
||||
echo -e "${GREEN}✅ Pass${NC}"
|
||||
echo ""
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}❌ Fail${NC}"
|
||||
echo ""
|
||||
((FAILED_TESTS++))
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Test Alpine Images (Native Platform)
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}Testing Alpine Images (Native Platform)${NC}"
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}💡 These images are built for your native architecture${NC}"
|
||||
echo -e "${YELLOW} They will run at full native speed without emulation${NC}"
|
||||
echo ""
|
||||
|
||||
test_image "ht-docker-node:alpine-node" \
|
||||
"Alpine with Node.js LTS + NVM + pnpm" \
|
||||
"nvm --version && node --version && pnpm --version"
|
||||
|
||||
test_image "ht-docker-node:alpine-deno" \
|
||||
"Alpine with Node.js LTS + NVM + Deno" \
|
||||
"nvm --version && node --version && deno --version"
|
||||
|
||||
test_image "ht-docker-node:alpine-bun" \
|
||||
"Alpine with Node.js LTS + NVM + Bun" \
|
||||
"nvm --version && node --version && bun --version"
|
||||
|
||||
# Test NVM version switching (critical feature)
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}Testing NVM Version Switching${NC}"
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
|
||||
test_image "ht-docker-node:alpine-node" \
|
||||
"NVM version switching" \
|
||||
"node --version && nvm install 18 && node --version | grep v18"
|
||||
|
||||
# Summary
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
if [ $FAILED_TESTS -eq 0 ]; then
|
||||
echo -e "${GREEN}✨ All Tests Passed! (0 failures)${NC}"
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}💡 In production, these same images will work natively on both amd64 and arm64${NC}"
|
||||
echo ""
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}❌ Some Tests Failed (${FAILED_TESTS} failures)${NC}"
|
||||
echo -e "${BLUE}════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user