-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·67 lines (58 loc) · 1.97 KB
/
docker-build.sh
File metadata and controls
executable file
·67 lines (58 loc) · 1.97 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
#!/bin/bash
set -euo pipefail
# Build script for 3DGS Video Processor Docker image
# Supports multi-arch builds using Docker Buildx (default builder)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"
IMAGE_NAME="${IMAGE_NAME:-3dgs-processor}"
IMAGE_TAG="${IMAGE_TAG:-latest}"
CPU_TAG="cpu-${IMAGE_TAG}"
GPU_TAG="gpu-${IMAGE_TAG}"
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
PUSH="${PUSH:-false}"
echo "========================================="
echo "Building 3DGS Video Processor"
echo "========================================="
echo "Image: ${IMAGE_NAME}:${CPU_TAG} (CPU variant)"
echo "Platforms: ${PLATFORMS}"
echo "Push: ${PUSH}"
echo "========================================="
# Check if buildx is available
if ! docker buildx version &> /dev/null; then
echo "ERROR: Docker Buildx is not available"
echo "Please install Docker Buildx or use Docker Desktop"
exit 1
fi
# Build arguments
BUILD_ARGS=(
--target cpu
-t "${IMAGE_NAME}:${CPU_TAG}"
)
# Add push flag if enabled
if [ "${PUSH}" = "true" ]; then
BUILD_ARGS+=(--platform "${PLATFORMS}" --push)
else
echo ""
echo "NOTE: Building for single platform (--load) since multi-arch requires --push"
echo "To build multi-arch, set PUSH=true and ensure you have a registry configured"
BUILD_ARGS+=(--platform linux/amd64 --load)
fi
# Build the image
echo ""
echo "Building Docker image..."
docker buildx build "${BUILD_ARGS[@]}" .
echo ""
echo "========================================="
echo "Build complete!"
echo "========================================="
if [ "${PUSH}" = "false" ]; then
echo ""
echo "To run the container (CPU variant):"
echo " docker run --rm ${IMAGE_NAME}:${CPU_TAG}"
echo ""
echo "To build GPU variant:"
echo " docker buildx build --target gpu --platform linux/amd64 --load -t ${IMAGE_NAME}:${GPU_TAG} ."
echo ""
echo "To build for multiple architectures and push (CPU variant):"
echo " PUSH=true ./docker-build.sh"
fi