Added requirements for faster builds

This commit is contained in:
SM
2025-02-04 11:48:26 -05:00
parent 1ddd292f5a
commit a56e2e1a1f
3 changed files with 38 additions and 0 deletions

30
DockerBuildPush.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/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="registry.gitlab.com/sascha3333/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"