mirror of
https://github.com/BillyOutlast/rocm-automated.git
synced 2026-02-04 03:51:19 +01:00
swapping to docker
This commit is contained in:
@@ -48,13 +48,13 @@ GFX_ARCHITECTURES["gfx1101"]="RDNA 3 (RX 7800 XT/7700 XT)"
|
||||
GFX_ARCHITECTURES["gfx1030"]="RDNA 2 (RX 6000 series)"
|
||||
GFX_ARCHITECTURES["gfx1201"]="RDNA 4 (RX 9060 XT/ RX 9070/XT)"
|
||||
|
||||
# Check if podman is available
|
||||
if ! command -v podman &> /dev/null; then
|
||||
print_error "podman is not installed or not in PATH"
|
||||
# Check if docker is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
print_error "docker is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_step "Building stable-diffusion.cpp podman images for different AMD GPU architectures..."
|
||||
print_step "Building stable-diffusion.cpp docker images for different AMD GPU architectures..."
|
||||
echo ""
|
||||
|
||||
# Build images for each architecture
|
||||
@@ -63,9 +63,9 @@ for gfx_name in "${!GFX_ARCHITECTURES[@]}"; do
|
||||
image_tag="${REGISTRY}/${BASE_IMAGE_NAME}:${gfx_name}"
|
||||
|
||||
print_step "Building for ${gfx_name} - ${architecture_desc}..."
|
||||
echo -e "${YELLOW}Command: podman build -t ${image_tag} --build-arg GFX_NAME=${gfx_name} -f ${Dockerfiles_DIR}/Dockerfile.stable-diffusion.cpp-rocm7.1 .${NC}"
|
||||
echo -e "${YELLOW}Command: docker build -t ${image_tag} --build-arg GFX_NAME=${gfx_name} -f ${Dockerfiles_DIR}/Dockerfile.stable-diffusion.cpp-rocm7.1 .${NC}"
|
||||
|
||||
if podman build -t "${image_tag}" \
|
||||
if docker build -t "${image_tag}" \
|
||||
--build-arg GFX_NAME="${gfx_name}" \
|
||||
-f "${Dockerfiles_DIR}/Dockerfile.stable-diffusion.cpp-rocm7.1" .; then
|
||||
print_success "Built ${image_tag} successfully"
|
||||
@@ -87,7 +87,7 @@ for gfx_name in "${!GFX_ARCHITECTURES[@]}"; do
|
||||
architecture_desc="${GFX_ARCHITECTURES[$gfx_name]}"
|
||||
|
||||
print_step "Pushing ${image_tag} (${architecture_desc})..."
|
||||
if podman push "${image_tag}"; then
|
||||
if docker push "${image_tag}"; then
|
||||
print_success "Pushed ${image_tag} successfully"
|
||||
else
|
||||
print_error "Failed to push ${image_tag}"
|
||||
@@ -110,7 +110,7 @@ for gfx_name in "${!GFX_ARCHITECTURES[@]}"; do
|
||||
done
|
||||
echo ""
|
||||
echo -e "${CYAN}To run an image:${NC}"
|
||||
echo -e " ${YELLOW}podman run -it --device=/dev/kfd --device=/dev/dri --group-add video -p 7860:7860 ${REGISTRY}/${BASE_IMAGE_NAME}:<gfx_name>${NC}"
|
||||
echo -e " ${YELLOW}docker run -it --device=/dev/kfd --device=/dev/dri --group-add video -p 7860:7860 ${REGISTRY}/${BASE_IMAGE_NAME}:<gfx_name>${NC}"
|
||||
echo ""
|
||||
echo -e "${CYAN}Example for RDNA 3:${NC}"
|
||||
echo -e " ${YELLOW}podman run -it --device=/dev/kfd --device=/dev/dri --group-add video -p 7860:7860 ${REGISTRY}/${BASE_IMAGE_NAME}:gfx1100${NC}"
|
||||
echo -e " ${YELLOW}docker run -it --device=/dev/kfd --device=/dev/dri --group-add video -p 7860:7860 ${REGISTRY}/${BASE_IMAGE_NAME}:gfx1100${NC}"
|
||||
22
build.sh
22
build.sh
@@ -39,15 +39,15 @@ print_error() {
|
||||
echo -e "${RED}❌ $1${NC}"
|
||||
}
|
||||
|
||||
# Check if podman is available
|
||||
if ! command -v podman &> /dev/null; then
|
||||
print_error "Podman is not installed or not in PATH"
|
||||
# Check if docker is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
print_error "docker is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_step "Building Fedora ROCm 7.1 base image..."
|
||||
echo -e "${YELLOW}Command: podman build -t ${FEDORA_IMAGE}:latest -f ${Dockerfiles_DIR}/Dockerfile.rocm-7.1${NC}"
|
||||
if podman build -t "${FEDORA_IMAGE}:latest" -f "${Dockerfiles_DIR}/Dockerfile.rocm-7.1"; then
|
||||
echo -e "${YELLOW}Command: docker build -t ${FEDORA_IMAGE}:latest -f ${Dockerfiles_DIR}/Dockerfile.rocm-7.1${NC}"
|
||||
if docker build -t "${FEDORA_IMAGE}:latest" -f "${Dockerfiles_DIR}/Dockerfile.rocm-7.1"; then
|
||||
print_success "Fedora ROCm 7.1 image built successfully"
|
||||
else
|
||||
print_error "Failed to build Fedora ROCm 7.1 image"
|
||||
@@ -55,7 +55,7 @@ else
|
||||
fi
|
||||
|
||||
print_step "Tagging Fedora ROCm 7.1 image for registry..."
|
||||
if podman tag "${FEDORA_IMAGE}:latest" "${REGISTRY}/${FEDORA_IMAGE}:latest"; then
|
||||
if docker tag "${FEDORA_IMAGE}:latest" "${REGISTRY}/${FEDORA_IMAGE}:latest"; then
|
||||
print_success "Tagged: ${REGISTRY}/${FEDORA_IMAGE}:latest"
|
||||
else
|
||||
print_error "Failed to tag Fedora ROCm 7.1 image"
|
||||
@@ -63,7 +63,7 @@ else
|
||||
fi
|
||||
|
||||
print_step "Pushing Fedora ROCm 7.1 image to registry..."
|
||||
if podman push "${REGISTRY}/${FEDORA_IMAGE}:latest"; then
|
||||
if docker push "${REGISTRY}/${FEDORA_IMAGE}:latest"; then
|
||||
print_success "Pushed: ${REGISTRY}/${FEDORA_IMAGE}:latest"
|
||||
else
|
||||
print_error "Failed to push Fedora ROCm 7.1 image"
|
||||
@@ -82,8 +82,8 @@ else
|
||||
print_error "Failed to build Ollama binary"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${YELLOW}Command: podman build -t ${OLLAMA_IMAGE}:latest -f ${Dockerfiles_DIR}/Dockerfile.ollama-rocm-7.1 .${NC}"
|
||||
if podman build -t "${OLLAMA_IMAGE}:latest" -f "${Dockerfiles_DIR}/Dockerfile.ollama-rocm-7.1" .; then
|
||||
echo -e "${YELLOW}Command: docker build -t ${OLLAMA_IMAGE}:latest -f ${Dockerfiles_DIR}/Dockerfile.ollama-rocm-7.1 .${NC}"
|
||||
if docker build -t "${OLLAMA_IMAGE}:latest" -f "${Dockerfiles_DIR}/Dockerfile.ollama-rocm-7.1" .; then
|
||||
print_success "Ollama ROCm 7.1 image built successfully"
|
||||
else
|
||||
print_error "Failed to build Ollama ROCm 7.1 image"
|
||||
@@ -91,7 +91,7 @@ else
|
||||
fi
|
||||
|
||||
print_step "Tagging Ollama ROCm 7.1 image for registry..."
|
||||
if podman tag "${OLLAMA_IMAGE}:latest" "${REGISTRY}/${OLLAMA_IMAGE}:latest"; then
|
||||
if docker tag "${OLLAMA_IMAGE}:latest" "${REGISTRY}/${OLLAMA_IMAGE}:latest"; then
|
||||
print_success "Tagged: ${REGISTRY}/${OLLAMA_IMAGE}:latest"
|
||||
else
|
||||
print_error "Failed to tag Ollama ROCm 7.1 image"
|
||||
@@ -99,7 +99,7 @@ else
|
||||
fi
|
||||
|
||||
print_step "Pushing Ollama ROCm 7.1 image to registry..."
|
||||
if podman push "${REGISTRY}/${OLLAMA_IMAGE}:latest"; then
|
||||
if docker push "${REGISTRY}/${OLLAMA_IMAGE}:latest"; then
|
||||
print_success "Pushed: ${REGISTRY}/${OLLAMA_IMAGE}:latest"
|
||||
else
|
||||
print_error "Failed to push Ollama ROCm 7.1 image"
|
||||
|
||||
@@ -6,32 +6,32 @@ REGISTRY="docker.io/getterup"
|
||||
Dockerfiles_DIR="./Dockerfiles"
|
||||
|
||||
|
||||
echo "Building ComfyUI podman images for different AMD GPU architectures..."
|
||||
echo "Building ComfyUI docker images for different AMD GPU architectures..."
|
||||
|
||||
# ROCm 7.1 (General compatibility)
|
||||
echo "Building ComfyUI with ROCm 7.1 (General)..."
|
||||
podman build -t ${REGISTRY}/comfyui:rocm7.1 \
|
||||
docker build -t ${REGISTRY}/comfyui:rocm7.1 \
|
||||
--build-arg PYTORCH_INDEX_URL="https://download.pytorch.org/whl/nightly/rocm7.1" \
|
||||
--build-arg GPU_ARCH="rocm7.1" \
|
||||
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
|
||||
|
||||
# RDNA 3 (RX 7000 series)
|
||||
echo "Building ComfyUI for RDNA 3 (RX 7000 series)..."
|
||||
podman build -t ${REGISTRY}/comfyui:rdna3-gfx110x \
|
||||
docker build -t ${REGISTRY}/comfyui:rdna3-gfx110x \
|
||||
--build-arg PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx110X-dgpu/" \
|
||||
--build-arg GPU_ARCH="gfx110X" \
|
||||
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
|
||||
|
||||
# RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)
|
||||
echo "Building ComfyUI for RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)..."
|
||||
podman build -t ${REGISTRY}/comfyui:rdna3.5-gfx1151 \
|
||||
docker build -t ${REGISTRY}/comfyui:rdna3.5-gfx1151 \
|
||||
--build-arg PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx1151/" \
|
||||
--build-arg GPU_ARCH="gfx1151" \
|
||||
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
|
||||
|
||||
# RDNA 4 (RX 9000 series)
|
||||
echo "Building ComfyUI for RDNA 4 (RX 9000 series)..."
|
||||
podman build -t ${REGISTRY}/comfyui:rdna4-gfx120x \
|
||||
docker build -t ${REGISTRY}/comfyui:rdna4-gfx120x \
|
||||
--build-arg PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx120X-all/" \
|
||||
--build-arg GPU_ARCH="gfx120X" \
|
||||
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
|
||||
@@ -42,16 +42,16 @@ echo "Pushing images to registry..."
|
||||
|
||||
# Push all images to registry
|
||||
echo "Pushing ${REGISTRY}/comfyui:rocm7.1..."
|
||||
podman push ${REGISTRY}/comfyui:rocm7.1
|
||||
docker push ${REGISTRY}/comfyui:rocm7.1
|
||||
|
||||
echo "Pushing ${REGISTRY}/comfyui:rdna3-gfx110x..."
|
||||
podman push ${REGISTRY}/comfyui:rdna3-gfx110x
|
||||
docker push ${REGISTRY}/comfyui:rdna3-gfx110x
|
||||
|
||||
echo "Pushing ${REGISTRY}/comfyui:rdna3.5-gfx1151..."
|
||||
podman push ${REGISTRY}/comfyui:rdna3.5-gfx1151
|
||||
docker push ${REGISTRY}/comfyui:rdna3.5-gfx1151
|
||||
|
||||
echo "Pushing ${REGISTRY}/comfyui:rdna4-gfx120x..."
|
||||
podman push ${REGISTRY}/comfyui:rdna4-gfx120x
|
||||
docker push ${REGISTRY}/comfyui:rdna4-gfx120x
|
||||
|
||||
echo ""
|
||||
echo "All images pushed to registry!"
|
||||
@@ -62,5 +62,5 @@ echo " - ${REGISTRY}/comfyui:rdna3-gfx110x (RDNA 3 - RX 7000 series)"
|
||||
echo " - ${REGISTRY}/comfyui:rdna3.5-gfx1151 (RDNA 3.5 - Strix halo/Ryzen AI Max+ 365)"
|
||||
echo " - ${REGISTRY}/comfyui:rdna4-gfx120x (RDNA 4 - RX 9000 series)"
|
||||
echo ""
|
||||
echo "Run with: podman run --rm --device=/dev/kfd --device=/dev/dri -p 8188:8188 ${REGISTRY}/comfyui:<tag>"
|
||||
echo "Run with: docker run --rm --device=/dev/kfd --device=/dev/dri -p 8188:8188 ${REGISTRY}/comfyui:<tag>"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ echo " - Best for development"
|
||||
echo ""
|
||||
echo "2. 🐳 Container-based extraction (build-venv-from-containers.sh)"
|
||||
echo " - Builds venvs in containers, then extracts them"
|
||||
echo " - Only requires Podman/Docker"
|
||||
echo " - Only requires docker/Docker"
|
||||
echo " - Isolated build environment"
|
||||
echo " - Best for deployment"
|
||||
echo ""
|
||||
|
||||
@@ -38,13 +38,13 @@ print_error() {
|
||||
echo -e "${RED}❌ $1${NC}"
|
||||
}
|
||||
|
||||
# Check for podman
|
||||
if ! command -v podman &> /dev/null; then
|
||||
print_error "Podman is not installed"
|
||||
# Check for docker
|
||||
if ! command -v docker &> /dev/null; then
|
||||
print_error "docker is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_success "Podman found"
|
||||
print_success "docker found"
|
||||
|
||||
# Create output directories
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
@@ -79,7 +79,7 @@ extract_venv() {
|
||||
|
||||
# Build container with venv
|
||||
print_step "Building container image for ${variant}..."
|
||||
if podman build \
|
||||
if docker build \
|
||||
--build-arg PYTORCH_INDEX_URL="${pytorch_url}" \
|
||||
--build-arg GPU_ARCH="${variant}" \
|
||||
-t "${image_name}" \
|
||||
@@ -93,7 +93,7 @@ extract_venv() {
|
||||
|
||||
# Create container to extract venv
|
||||
print_step "Creating temporary container..."
|
||||
podman create --name "${container_name}" "${image_name}"
|
||||
docker create --name "${container_name}" "${image_name}"
|
||||
|
||||
# Extract the virtual environment
|
||||
print_step "Extracting virtual environment..."
|
||||
@@ -101,12 +101,12 @@ extract_venv() {
|
||||
mkdir -p "${extract_path}"
|
||||
|
||||
# Extract the venv and ComfyUI
|
||||
if podman cp "${container_name}:/app/ComfyUI/venv" "${extract_path}/" && \
|
||||
podman cp "${container_name}:/app/ComfyUI" "${extract_path}/ComfyUI"; then
|
||||
if docker cp "${container_name}:/app/ComfyUI/venv" "${extract_path}/" && \
|
||||
docker cp "${container_name}:/app/ComfyUI" "${extract_path}/ComfyUI"; then
|
||||
print_success "Virtual environment extracted"
|
||||
else
|
||||
print_error "Failed to extract venv for ${variant}"
|
||||
podman rm "${container_name}" 2>/dev/null || true
|
||||
docker rm "${container_name}" 2>/dev/null || true
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -160,12 +160,12 @@ EOF
|
||||
chmod +x "${extract_path}/launch_comfyui_${variant}.sh"
|
||||
|
||||
# Clean up container
|
||||
podman rm "${container_name}"
|
||||
docker rm "${container_name}"
|
||||
|
||||
# Optionally remove the image to save space
|
||||
read -p "Remove container image for ${variant} to save space? (y/N): " remove_image
|
||||
if [[ $remove_image =~ ^[Yy]$ ]]; then
|
||||
podman rmi "${image_name}"
|
||||
docker rmi "${image_name}"
|
||||
print_success "Container image removed"
|
||||
fi
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ command_exists() {
|
||||
}
|
||||
|
||||
# Check for required tools
|
||||
if ! command_exists podman; then
|
||||
echo "Error: podman is not installed or not in PATH"
|
||||
echo "Please install podman first"
|
||||
if ! command_exists docker; then
|
||||
echo "Error: docker is not installed or not in PATH"
|
||||
echo "Please install docker first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -38,7 +38,7 @@ if ! command_exists git; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Required tools found: podman, git"
|
||||
echo "✓ Required tools found: docker, git"
|
||||
|
||||
# Create directories
|
||||
mkdir -p "${BUILD_OUTPUT_DIR}"
|
||||
@@ -47,10 +47,10 @@ mkdir -p "${BUILD_OUTPUT_DIR}/lib"
|
||||
mkdir -p "${GOMODCACHE}"
|
||||
|
||||
# Clean up existing container if it exists
|
||||
if podman ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||
if docker ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||
echo "Removing existing container: ${CONTAINER_NAME}"
|
||||
podman stop ${CONTAINER_NAME} 2>/dev/null || true
|
||||
podman rm ${CONTAINER_NAME} 2>/dev/null || true
|
||||
docker stop ${CONTAINER_NAME} 2>/dev/null || true
|
||||
docker rm ${CONTAINER_NAME} 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Clone or update the repository
|
||||
@@ -78,11 +78,11 @@ echo "Output path: ${ABSOLUTE_OUTPUT_PATH}"
|
||||
|
||||
# Pull the base image
|
||||
echo "Pulling base image: ${BASE_IMAGE}"
|
||||
podman pull "${BASE_IMAGE}"
|
||||
docker pull "${BASE_IMAGE}"
|
||||
|
||||
# Create and start the build container
|
||||
echo "Creating build container..."
|
||||
podman run -d \
|
||||
docker run -d \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--hostname ollama-build \
|
||||
-v "${ABSOLUTE_SOURCE_PATH}:${MOUNT_SOURCE_PATH}:Z" \
|
||||
@@ -110,7 +110,7 @@ podman run -d \
|
||||
echo "✓ Container '${CONTAINER_NAME}' created and started"
|
||||
|
||||
echo "Installing CMake ${CMAKEVERSION}..."
|
||||
podman exec ${CONTAINER_NAME} bash -c "
|
||||
docker exec ${CONTAINER_NAME} bash -c "
|
||||
curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKEVERSION}/cmake-${CMAKEVERSION}-linux-\$(uname -m).tar.gz | tar xz -C /usr/local --strip-components 1
|
||||
"
|
||||
|
||||
@@ -118,7 +118,7 @@ echo "✓ CMake installed"
|
||||
|
||||
# Set up build environment and run the build
|
||||
echo "Starting Ollama build process..."
|
||||
podman exec ${CONTAINER_NAME} bash -c "
|
||||
docker exec ${CONTAINER_NAME} bash -c "
|
||||
set -e
|
||||
echo '=== Setting up build environment ==='
|
||||
export PATH=/opt/rocm/hcc/bin:/opt/rocm/hip/bin:/opt/rocm/bin:/opt/rocm/hcc/bin:\$PATH
|
||||
@@ -181,8 +181,8 @@ fi
|
||||
|
||||
# Clean up container
|
||||
echo "Cleaning up build container..."
|
||||
podman stop ${CONTAINER_NAME}
|
||||
podman rm ${CONTAINER_NAME}
|
||||
docker stop ${CONTAINER_NAME}
|
||||
docker rm ${CONTAINER_NAME}
|
||||
|
||||
echo ""
|
||||
echo "=== Build Complete ==="
|
||||
|
||||
Reference in New Issue
Block a user