-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-build-push.sh
More file actions
executable file
·58 lines (47 loc) · 1.69 KB
/
docker-build-push.sh
File metadata and controls
executable file
·58 lines (47 loc) · 1.69 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
#!/bin/bash
# Multi-architecture Docker build and push script for mkcertWeb
# Builds for linux/amd64 (Intel/AMD) and linux/arm64 (ARM64)
set -e
# Configuration
IMAGE_NAME="jeffcaldwellca/mkcertweb"
VERSION="3.1.3"
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}Starting multi-architecture build for ${IMAGE_NAME}:${VERSION}${NC}"
# Check if logged into Docker Hub
#echo -e "${BLUE}Checking Docker Hub login...${NC}"
#if ! docker info | grep -q "Username"; then
# echo -e "${RED}Not logged into Docker Hub. Please run: docker login${NC}"
# exit 1
#fi
# Create and use buildx builder if not exists
echo -e "${BLUE}Setting up buildx builder...${NC}"
if ! docker buildx ls | grep -q "multiarch"; then
docker buildx create --name multiarch --use
else
docker buildx use multiarch
fi
# Bootstrap the builder
docker buildx inspect --bootstrap
# Build and push multi-architecture image
echo -e "${BLUE}Building and pushing multi-arch images...${NC}"
echo -e "${BLUE}Platforms: linux/amd64, linux/arm64${NC}"
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ${IMAGE_NAME}:${VERSION} \
--tag ${IMAGE_NAME}:latest \
--push \
.
echo -e "${GREEN}✓ Successfully built and pushed multi-architecture images!${NC}"
echo -e "${GREEN}✓ Available platforms: linux/amd64, linux/arm64${NC}"
echo -e "${GREEN}✓ Tags: ${IMAGE_NAME}:${VERSION}, ${IMAGE_NAME}:latest${NC}"
echo ""
echo -e "${BLUE}To verify the image manifest:${NC}"
echo " docker buildx imagetools inspect ${IMAGE_NAME}:${VERSION}"
echo ""
echo -e "${BLUE}To pull and run:${NC}"
echo " docker pull ${IMAGE_NAME}:${VERSION}"
echo " docker-compose up -d"