-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-push.sh
More file actions
executable file
·35 lines (29 loc) · 1.1 KB
/
build-and-push.sh
File metadata and controls
executable file
·35 lines (29 loc) · 1.1 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
#!/bin/bash
set -e
# Multi-architecture Docker build and push script for compliance-cli
# Builds for both linux/amd64 and linux/arm64
IMAGE_NAME="us-docker.pkg.dev/u2i-bootstrap/docker-images/compliance-cli-builder"
IMAGE_TAG="${1:-latest}"
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
echo "Building multi-arch Docker image: ${FULL_IMAGE}"
echo "Platforms: linux/amd64, linux/arm64"
# Ensure buildx is available and create/use builder
if ! docker buildx ls | grep -q orbstack-builder; then
echo "Creating buildx builder..."
docker buildx create --name orbstack-builder --driver docker-container --use
else
echo "Using existing buildx builder..."
docker buildx use orbstack-builder
fi
# Build and push in one step (buildx requires --push for multi-arch)
echo "Building and pushing multi-arch image..."
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "${FULL_IMAGE}" \
--push \
.
echo "Successfully pushed multi-arch image: ${FULL_IMAGE}"
echo ""
echo "To use in Cloud Build:"
echo " - name: '${FULL_IMAGE}'"
echo " args: ['-c', 'compliance-cli preview destroy --pr \$_PR_NUMBER']"