31 lines
975 B
Bash
31 lines
975 B
Bash
#!/bin/bash
|
|
|
|
# Get the directory of the script (which should be the root of your repo)
|
|
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
|
|
|
# Set variables
|
|
FULL_IMAGE_NAME="mystmaker33/python-uv-base:latest"
|
|
|
|
# Pull the latest changes from the Git repository
|
|
echo "Pulling the latest changes from the Git repository..."
|
|
git pull origin main
|
|
|
|
# Enable BuildKit for multi-platform builds
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
# Ensure Buildx is set up for multi-platform builds
|
|
echo "Setting up Buildx for multi-platform builds..."
|
|
if ! docker buildx inspect multiarch-builder > /dev/null 2>&1; then
|
|
docker buildx create --name multiarch-builder --use
|
|
docker buildx inspect --bootstrap
|
|
fi
|
|
|
|
# Build and push the Docker image for both ARM and AMD architectures
|
|
echo "Building and pushing multi-platform Docker image..."
|
|
docker buildx build \
|
|
--platform linux/arm64,linux/amd64 \
|
|
--tag $FULL_IMAGE_NAME \
|
|
--push .
|
|
|
|
echo "Docker image built and pushed successfully: $FULL_IMAGE_NAME"
|