Skip to content

Commit 80ffee3

Browse files
fix: Relativ path issues fixed
1 parent 17d65a2 commit 80ffee3

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

infra/scripts/docker-build.ps1

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# Get all environment values
33
$envValues = azd env get-values --output json | ConvertFrom-Json
44

5+
# Full path to this script's folder
6+
$ScriptDir = $PSScriptRoot
7+
8+
# Resolve relative paths based on the script location
9+
$TemplateFile = Join-Path $ScriptDir "..\deploy_container_registry.bicep"
10+
$ContentProcessorPath = Join-Path $ScriptDir "..\..\src\ContentProcessor"
11+
$ContentApiPath = Join-Path $ScriptDir "..\..\src\ContentProcessorAPI"
12+
$ContentWebPath = Join-Path $ScriptDir "..\..\src\ContentProcessorWeb"
13+
514
# Define function to build and push Docker images
615
function Build-And-Push-Image {
716
param (
@@ -110,7 +119,7 @@ Write-Output "Starting build process."
110119

111120
# Deploy container registry
112121
Write-Host "Deploying container registry"
113-
$OUTPUTS = az deployment group create --resource-group $AZURE_RESOURCE_GROUP --template-file "./infra/deploy_container_registry.bicep" --parameters environmentName=$ENV_NAME acrPullPrincipalIds="['$($CONTAINER_APP_USER_PRINCIPAL_ID)']" --query "properties.outputs" --output json | ConvertFrom-Json
122+
$OUTPUTS = az deployment group create --resource-group $AZURE_RESOURCE_GROUP --template-file "$TemplateFile" --parameters environmentName=$ENV_NAME acrPullPrincipalIds="['$($CONTAINER_APP_USER_PRINCIPAL_ID)']" --query "properties.outputs" --output json | ConvertFrom-Json
114123

115124
# Extract ACR name and endpoint
116125
$ACR_NAME = $OUTPUTS.createdAcrName.value
@@ -134,8 +143,8 @@ if ($LASTEXITCODE -ne 0) {
134143
}
135144

136145
# Build and push images
137-
Build-And-Push-Image "contentprocessor" ".\src\ContentProcessor\" $CONTAINER_APP_NAME
138-
Build-And-Push-Image "contentprocessorapi" ".\src\ContentProcessorAPI\" $CONTAINER_API_APP_NAME
139-
Build-And-Push-Image "contentprocessorweb" ".\src\ContentProcessorWeb\" $CONTAINER_WEB_APP_NAME
146+
Build-And-Push-Image "contentprocessor" "$ContentProcessorPath" $CONTAINER_APP_NAME
147+
Build-And-Push-Image "contentprocessorapi" "$ContentApiPath" $CONTAINER_API_APP_NAME
148+
Build-And-Push-Image "contentprocessorweb" "$ContentWebPath" $CONTAINER_WEB_APP_NAME
140149

141150
Write-Host "All Docker images built and pushed successfully."

infra/scripts/docker-build.sh

100644100755
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ set -e
66
echo "Fetching environment values from azd..."
77
ENV_VALUES_JSON=$(azd env get-values --output json)
88

9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
TEMPLATE_FILE="$SCRIPT_DIR/../deploy_container_registry.bicep"
11+
912
get_azd_env_value_or_default() {
1013
local key="$1"
1114
local default="$2"
@@ -54,7 +57,7 @@ fi
5457
echo "Deploying container registry..."
5558
DEPLOY_OUTPUT=$(az deployment group create \
5659
--resource-group "$AZURE_RESOURCE_GROUP" \
57-
--template-file "./infra/deploy_container_registry.bicep" \
60+
--template-file "$TEMPLATE_FILE" \
5861
--parameters environmentName="$ENV_NAME" acrPullPrincipalIds="['$CONTAINER_APP_USER_PRINCIPAL_ID']" \
5962
--query "properties.outputs" \
6063
--output json)
@@ -104,8 +107,10 @@ build_and_push_image() {
104107
}
105108

106109
# Build and push all images
107-
build_and_push_image "contentprocessor" "./src/ContentProcessor/" "$CONTAINER_APP_NAME"
108-
build_and_push_image "contentprocessorapi" "./src/ContentProcessorAPI/" "$CONTAINER_API_APP_NAME"
109-
build_and_push_image "contentprocessorweb" "./src/ContentProcessorWeb/" "$CONTAINER_WEB_APP_NAME"
110+
build_and_push_image "contentprocessor" "$SCRIPT_DIR/../../src/ContentProcessor/" "$CONTAINER_APP_NAME"
111+
112+
build_and_push_image "contentprocessorapi" "$SCRIPT_DIR/../../src/ContentProcessorAPI/" "$CONTAINER_API_APP_NAME"
113+
114+
build_and_push_image "contentprocessorweb" "$SCRIPT_DIR/../../src/ContentProcessorWeb/" "$CONTAINER_WEB_APP_NAME"
110115

111116
echo "All Docker images built and pushed successfully."

0 commit comments

Comments
 (0)