Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 36 additions & 32 deletions infra/scripts/acr_build_push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ Write-Host " Resource Group: $RESOURCE_GROUP"
Write-Host " Image Tag: $IMAGE_TAG"
Write-Host ""

function Build-Image {
param(
[Parameter(Mandatory = $true)]
[string]$ImageName,
[Parameter(Mandatory = $true)]
[string]$Dockerfile,
[Parameter(Mandatory = $true)]
[string]$BuildContext
)

az acr build `
--registry $ACR_NAME `
--image "${ImageName}:$IMAGE_TAG" `
--file $Dockerfile `
--platform linux `
$BuildContext

if ($LASTEXITCODE -ne 0) { throw "Failed to build $ImageName image" }
}

try {
# =============================================================================
# Step 1: Build and push images to ACR using az acr build
Expand All @@ -146,53 +166,37 @@ try {
# --- ContentProcessor ---
Write-Host ""
Write-Host " Building contentprocessor image..."
az acr build `
--registry $ACR_NAME `
--image "contentprocessor:$IMAGE_TAG" `
--file "$RepoRoot\src\ContentProcessor\Dockerfile" `
--platform linux `
"$RepoRoot\src\ContentProcessor"

if ($LASTEXITCODE -ne 0) { throw "Failed to build contentprocessor image" }
Build-Image `
-ImageName "contentprocessor" `
-Dockerfile "$RepoRoot\src\ContentProcessor\Dockerfile" `
-BuildContext "$RepoRoot\src\ContentProcessor"
Write-Host " [OK] contentprocessor image built and pushed."

# --- ContentProcessorAPI ---
Write-Host ""
Write-Host " Building contentprocessorapi image..."
az acr build `
--registry $ACR_NAME `
--image "contentprocessorapi:$IMAGE_TAG" `
--file "$RepoRoot\src\ContentProcessorAPI\Dockerfile" `
--platform linux `
"$RepoRoot\src\ContentProcessorAPI"

if ($LASTEXITCODE -ne 0) { throw "Failed to build contentprocessorapi image" }
Build-Image `
-ImageName "contentprocessorapi" `
-Dockerfile "$RepoRoot\src\ContentProcessorAPI\Dockerfile" `
-BuildContext "$RepoRoot\src\ContentProcessorAPI"
Write-Host " [OK] contentprocessorapi image built and pushed."

# --- ContentProcessorWeb ---
Write-Host ""
Write-Host " Building contentprocessorweb image..."
az acr build `
--registry $ACR_NAME `
--image "contentprocessorweb:$IMAGE_TAG" `
--file "$RepoRoot\src\ContentProcessorWeb\Dockerfile" `
--platform linux `
"$RepoRoot\src\ContentProcessorWeb"

if ($LASTEXITCODE -ne 0) { throw "Failed to build contentprocessorweb image" }
Build-Image `
-ImageName "contentprocessorweb" `
-Dockerfile "$RepoRoot\src\ContentProcessorWeb\Dockerfile" `
-BuildContext "$RepoRoot\src\ContentProcessorWeb"
Write-Host " [OK] contentprocessorweb image built and pushed."

# --- ContentProcessorWorkflow ---
Write-Host ""
Write-Host " Building contentprocessorworkflow image..."
az acr build `
--registry $ACR_NAME `
--image "contentprocessorworkflow:$IMAGE_TAG" `
--file "$RepoRoot\src\ContentProcessorWorkflow\Dockerfile" `
--platform linux `
"$RepoRoot\src\ContentProcessorWorkflow"

if ($LASTEXITCODE -ne 0) { throw "Failed to build contentprocessorworkflow image" }
Build-Image `
-ImageName "contentprocessorworkflow" `
-Dockerfile "$RepoRoot\src\ContentProcessorWorkflow\Dockerfile" `
-BuildContext "$RepoRoot\src\ContentProcessorWorkflow"
Write-Host " [OK] contentprocessorworkflow image built and pushed."

Write-Host ""
Expand Down
53 changes: 29 additions & 24 deletions infra/scripts/acr_build_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ cleanup() {

trap cleanup EXIT

build_image() {
local image_name="$1"
local dockerfile="$2"
local build_context="$3"

az acr build \
--registry "$ACR_NAME" \
--image "$image_name:$IMAGE_TAG" \
--file "$dockerfile" \
--platform linux \
"$build_context"
}

# =============================================================================
# Step 1: Build and push images to ACR using az acr build
# =============================================================================
Expand All @@ -156,48 +169,40 @@ echo "============================================================"
# --- ContentProcessor ---
echo ""
echo " Building contentprocessor image..."
az acr build \
--registry "$ACR_NAME" \
--image "contentprocessor:$IMAGE_TAG" \
--file "$REPO_ROOT/src/ContentProcessor/Dockerfile" \
--platform linux \
"$REPO_ROOT/src/ContentProcessor"
build_image \
"contentprocessor" \
"$REPO_ROOT/src/ContentProcessor/Dockerfile" \
"$REPO_ROOT/src/ContentProcessor"

echo " ✅ contentprocessor image built and pushed."

# --- ContentProcessorAPI ---
echo ""
echo " Building contentprocessorapi image..."
az acr build \
--registry "$ACR_NAME" \
--image "contentprocessorapi:$IMAGE_TAG" \
--file "$REPO_ROOT/src/ContentProcessorAPI/Dockerfile" \
--platform linux \
"$REPO_ROOT/src/ContentProcessorAPI"
build_image \
"contentprocessorapi" \
"$REPO_ROOT/src/ContentProcessorAPI/Dockerfile" \
"$REPO_ROOT/src/ContentProcessorAPI"

echo " ✅ contentprocessorapi image built and pushed."

# --- ContentProcessorWeb ---
echo ""
echo " Building contentprocessorweb image..."
az acr build \
--registry "$ACR_NAME" \
--image "contentprocessorweb:$IMAGE_TAG" \
--file "$REPO_ROOT/src/ContentProcessorWeb/Dockerfile" \
--platform linux \
"$REPO_ROOT/src/ContentProcessorWeb"
build_image \
"contentprocessorweb" \
"$REPO_ROOT/src/ContentProcessorWeb/Dockerfile" \
"$REPO_ROOT/src/ContentProcessorWeb"

echo " ✅ contentprocessorweb image built and pushed."

# --- ContentProcessorWorkflow ---
echo ""
echo " Building contentprocessorworkflow image..."
az acr build \
--registry "$ACR_NAME" \
--image "contentprocessorworkflow:$IMAGE_TAG" \
--file "$REPO_ROOT/src/ContentProcessorWorkflow/Dockerfile" \
--platform linux \
"$REPO_ROOT/src/ContentProcessorWorkflow"
build_image \
"contentprocessorworkflow" \
"$REPO_ROOT/src/ContentProcessorWorkflow/Dockerfile" \
"$REPO_ROOT/src/ContentProcessorWorkflow"

echo " ✅ contentprocessorworkflow image built and pushed."

Expand Down