-
Notifications
You must be signed in to change notification settings - Fork 290
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·47 lines (39 loc) · 1.4 KB
/
build.sh
File metadata and controls
executable file
·47 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
# Detect architecture
ARCH=$(uname -m)
echo "🔍 Detected architecture: $ARCH"
# Set build arguments based on architecture
if [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then
echo "🔧 ARM64 detected, skipping Puppeteer in build"
BUILD_ARGS="--build-arg ENABLE_PUPPETEER=false"
TAG_SUFFIX="arm64"
elif [[ "$ARCH" == "x86_64" || "$ARCH" == "amd64" ]]; then
echo "🔧 x86_64 detected, including all engines"
BUILD_ARGS="--build-arg ENABLE_PUPPETEER=true"
TAG_SUFFIX="amd64"
else
echo "⚠️ Unknown architecture $ARCH, using default config (skip Puppeteer)"
BUILD_ARGS="--build-arg ENABLE_PUPPETEER=false"
TAG_SUFFIX="unknown"
fi
# Set image tags
IMAGE_TAG=${1:-"anycrawl:latest"}
ARCH_TAG="anycrawl:${TAG_SUFFIX}"
echo "🏗️ Starting image build..."
echo " Image tags: $IMAGE_TAG, $ARCH_TAG"
echo " Build args: $BUILD_ARGS"
# Build image
eval "docker build $BUILD_ARGS -t $IMAGE_TAG -t $ARCH_TAG ."
echo "✅ Build completed!"
echo "📋 Image info:"
docker images | grep anycrawl | head -5
echo "🚀 Usage:"
echo " docker run -d --name anycrawl -p 8080:8080 $IMAGE_TAG"
# Show supported engines
if [[ "$BUILD_ARGS" == *"ENABLE_PUPPETEER=false"* ]]; then
echo "🔄 Supported engines: Playwright, Cheerio"
echo "❌ Skipped engines: Puppeteer (architecture incompatible)"
else
echo "🔄 Supported engines: Playwright, Cheerio, Puppeteer"
fi