I have a problem deploying my angular app to Azure storage static website. I created a CI/CD pipeline last year, I was using it for months. There was no deployment in the past few months, and with today's deployment I ran into some problems.
The first problem was about authentication, but I was able to solve it.
The second is the one I'm struggling with. I run the release pipeline, and the files are copied, but not in the $web container root, but it creates a 'prod' folder, and copies files there. Because of this, I can not open the website, as it searches for the 'index.html' file in the $web root folder, and obviously doesn't find it, as it is in the $web/prod folder. I can open the file going to /prod URL, but then it tries to load all resources from the root (so not the prod folder), and obviously the files aren't there.
I looked at some articles about deploying to static webiste storage account, and all of them showed similar yamls to what I'm using.
Here's my build pipeline which publishes the artifacts after build:
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/dist/prod'
ArtifactName: 'prod'
publishLocation: 'Container'
displayName: 'publish prod'
And here is the file copy task:
- task: AzureFileCopy@4
displayName: 'AzureBlob File Copy'
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/_angularApp CI/prod'
azureSubscription: '***'
Destination: AzureBlob
storage: angularApp
ContainerName: '$web'
The files are there after the 'PublishBuildArtifact' task, they are copied, just not in the correct folder ($web root). Does anybody have an idea?
Thanks
Usually, without specifying Blob Prefix, the content in the specified folder is copied to the root of the container by default.
Tested on my side, it works well:
You can check whether your publish source directory contains a folder named prod
and copy this folder to the container.
In addition, the AzureFileCopy@3 version I used here, you can try to use V3 azure copy file task.