test
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Docker Build Test Script ==="
|
||||
echo "Testing Dockerfile.stable build process..."
|
||||
echo "Choose build type:"
|
||||
echo "1. Fast build (skip Tesseract, ~3-5 minutes)"
|
||||
echo "2. Full build (include all features, ~10-15 minutes)"
|
||||
echo
|
||||
read -p "Enter choice (1 or 2, default=1): " choice
|
||||
|
||||
# 默认选择快速构建
|
||||
if [ -z "$choice" ]; then
|
||||
choice=1
|
||||
fi
|
||||
|
||||
if [ "$choice" = "1" ]; then
|
||||
DOCKERFILE="Dockerfile.fast"
|
||||
TAG="digital-archive:fast"
|
||||
echo "🚀 Using fast build (Dockerfile.fast)"
|
||||
else
|
||||
DOCKERFILE="Dockerfile.stable"
|
||||
TAG="digital-archive:stable"
|
||||
echo "🔧 Using full build (Dockerfile.stable)"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
# 检查Docker是否可用
|
||||
@@ -16,20 +36,21 @@ echo "✓ Docker found: $(docker --version)"
|
||||
# 构建镜像
|
||||
echo
|
||||
echo "🏗️ Building Docker image..."
|
||||
echo "Using $DOCKERFILE, tag: $TAG"
|
||||
echo "This may take several minutes..."
|
||||
|
||||
if docker build -f Dockerfile.stable -t digital-archive:test .; then
|
||||
if docker build -f $DOCKERFILE -t $TAG .; then
|
||||
echo
|
||||
echo "✅ Build successful!"
|
||||
echo
|
||||
echo "📋 Image details:"
|
||||
docker images digital-archive:test
|
||||
docker images $TAG
|
||||
|
||||
echo
|
||||
echo "🧪 Testing container startup..."
|
||||
|
||||
# 测试容器启动
|
||||
if docker run --rm --name test-container digital-archive:test java -version; then
|
||||
if docker run --rm --name test-container $TAG java -version; then
|
||||
echo "✅ Container test successful!"
|
||||
else
|
||||
echo "❌ Container test failed"
|
||||
@@ -38,7 +59,7 @@ if docker build -f Dockerfile.stable -t digital-archive:test .; then
|
||||
# 清理测试镜像
|
||||
echo
|
||||
echo "🧹 Cleaning up test image..."
|
||||
docker rmi digital-archive:test
|
||||
docker rmi $TAG
|
||||
|
||||
else
|
||||
echo
|
||||
@@ -50,7 +71,11 @@ else
|
||||
echo "3. Check network connectivity for package downloads"
|
||||
echo "4. Verify src/main/lib/ directory contains all required JAR files"
|
||||
echo "5. Try running with --no-cache flag:"
|
||||
echo " docker build --no-cache -f Dockerfile.stable -t digital-archive:test ."
|
||||
if [ "$choice" = "1" ]; then
|
||||
echo " docker build --no-cache -f Dockerfile.fast -t digital-archive:fast ."
|
||||
else
|
||||
echo " docker build --no-cache -f Dockerfile.stable -t digital-archive:stable ."
|
||||
fi
|
||||
echo
|
||||
echo "📋 Checking required files..."
|
||||
if [ -f "pom.xml" ]; then
|
||||
|
||||
Reference in New Issue
Block a user