-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpublish_docker.sh
More file actions
executable file
·65 lines (51 loc) · 2.36 KB
/
Copy pathpublish_docker.sh
File metadata and controls
executable file
·65 lines (51 loc) · 2.36 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
# TeaQL Forge Rust Docker Release Script
# Usage: ./publish_docker.sh [TAG]
# Example: ./publish_docker.sh v1.0.0 (Defaults to 'latest' if no tag is provided)
TAG=${1:-latest}
IMAGE_NAME="teaql/teaql-forge-rs"
echo "========================================"
echo "🚀 Building TeaQL Forge Rust Docker Image"
echo "📦 Image: ${IMAGE_NAME}:${TAG}"
echo "========================================"
# 1. Check dependencies
if ! command -v cargo-zigbuild &> /dev/null; then
echo "❌ cargo-zigbuild not found. Please install it with:"
echo " cargo install cargo-zigbuild"
exit 1
fi
echo "✅ Dependencies checked."
# 2. Build for both architectures using zigbuild
echo "🔨 Compiling for x86_64 and aarch64..."
cargo zigbuild --target x86_64-unknown-linux-musl --target aarch64-unknown-linux-musl --release -p teaql-forge-server
# 3. Find the shared target directory reliably
TARGET_DIR=$(cargo metadata --format-version 1 --no-deps | jq -r .target_directory)
echo "📂 Target directory: $TARGET_DIR"
# 4. Build and Push AMD64
echo "----------------------------------------"
echo "🐳 Building and pushing AMD64 image..."
cp "${TARGET_DIR}/x86_64-unknown-linux-musl/release/teaql-forge-server" ./teaql-forge-server-bin
docker build --platform linux/amd64 -t "${IMAGE_NAME}:${TAG}-amd64" .
docker push "${IMAGE_NAME}:${TAG}-amd64"
# 5. Build and Push ARM64
echo "----------------------------------------"
echo "🐳 Building and pushing ARM64 image..."
cp "${TARGET_DIR}/aarch64-unknown-linux-musl/release/teaql-forge-server" ./teaql-forge-server-bin
docker build --platform linux/arm64 -t "${IMAGE_NAME}:${TAG}-arm64" .
docker push "${IMAGE_NAME}:${TAG}-arm64"
# 6. Create and Push Multi-Arch Manifest
echo "----------------------------------------"
echo "🔗 Creating and pushing multi-arch manifest..."
# Remove local manifest if it exists to avoid conflicts from previous runs
docker manifest rm "${IMAGE_NAME}:${TAG}" 2>/dev/null || true
docker manifest create "${IMAGE_NAME}:${TAG}" \
"${IMAGE_NAME}:${TAG}-amd64" \
"${IMAGE_NAME}:${TAG}-arm64"
docker manifest push "${IMAGE_NAME}:${TAG}"
# Cleanup
rm -f ./teaql-forge-server-bin
echo "========================================"
echo "✅ Successfully published ${IMAGE_NAME}:${TAG} !"
echo "You can now run: docker run -d -p 8080:8080 ${IMAGE_NAME}:${TAG}"
echo "========================================"