Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
104 lines (86 loc) · 2.61 KB
/
Copy pathbuild.sh
File metadata and controls
104 lines (86 loc) · 2.61 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# PyUnit 2.0 - Build Script
# This script builds Docker image and publishes it to Docker Hub
# Run this on your development machine (Windows/Linux/macOS)
set -e
echo "========================================="
echo "PyUnit 2.0 - Docker Image Build Script"
echo "========================================="
echo ""
# Configuration - CHANGE THIS!
DOCKER_USERNAME="xatang" # Your Docker Hub username
DOCKER_IMAGE="${DOCKER_USERNAME}/pyunit"
VERSION="latest" # or use version like "2.0.3"
echo "Docker Image: ${DOCKER_IMAGE}:${VERSION}"
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed!"
echo "Please install Docker Desktop: https://docs.docker.com/get-docker/"
exit 1
fi
echo "✓ Docker is installed"
echo ""
# Check if logged in to Docker Hub
echo "Checking Docker Hub authentication..."
if ! docker info | grep -q "Username"; then
echo "⚠️ Not logged in to Docker Hub"
echo "Please login:"
docker login
if [ $? -ne 0 ]; then
echo "❌ Docker login failed"
exit 1
fi
fi
echo "✓ Logged in to Docker Hub"
echo ""
# Setup buildx for multi-platform
echo "========================================="
echo "Setting up multi-platform builder..."
echo "========================================="
echo ""
# Create builder if not exists
if ! docker buildx ls | grep -q "multiplatform"; then
docker buildx create --name multiplatform --driver docker-container --bootstrap
fi
# Use the builder
docker buildx use multiplatform
echo "✓ Multi-platform builder ready"
echo ""
# Build image for multiple platforms
echo "========================================="
echo "Building Docker image for multiple platforms..."
echo "========================================="
echo ""
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 \
-t ${DOCKER_IMAGE}:${VERSION} \
--push \
.
if [ $? -ne 0 ]; then
echo ""
echo "❌ Build failed!"
exit 1
fi
echo ""
echo "✓ Build successful!"
echo ""
echo "========================================="
echo "✓ Successfully published!"
echo "========================================="
echo ""
echo "Image available at:"
echo " https://hub.docker.com/r/${DOCKER_USERNAME}/pyunit"
echo ""
echo "Image supports:"
echo " - linux/amd64 (x86_64)"
echo " - linux/arm64 (ARM 64-bit)"
echo " - linux/arm/v7 (ARMv7 32-bit)"
echo " - linux/arm/v8 (ARMv8 32-bit)"
echo ""
echo "Users can install with:"
echo " ./install.sh"
echo ""
echo "========================================="
echo "Build completed!"
echo "========================================="