Update azure-pipelines.yml for Azure Pipelines
This commit is contained in:
parent
8a803ad157
commit
8349e78f6e
@ -1,5 +1,8 @@
|
|||||||
name: Build & Push to ACR Pipeline
|
name: Build & Push to ACR Pipeline
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
- '*'
|
||||||
|
|
||||||
pr:
|
pr:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
@ -7,19 +10,52 @@ pool:
|
|||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: 'BuildAndPush'
|
- job: BuildAndPushImages
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-latest'
|
|
||||||
steps:
|
steps:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
- script: |
|
|
||||||
export DOCKER_CLI_CONTEXT=default
|
|
||||||
docker-compose -f **/docker-compose.yml build
|
|
||||||
docker login -u dadeSchoolsContainerRegistry -p k1f8hE0O5hj3tYCCR/5stNrkw5BZoTmAqid/hvaVo8+ACRDc2Arn dadeschoolscontainerregistry.azurecr.io
|
|
||||||
docker-compose -f **/docker-compose.yml push
|
|
||||||
displayName: 'Build and Push Docker Compose Project'
|
|
||||||
|
|
||||||
trigger:
|
- bash: |
|
||||||
branches:
|
#!/bin/bash
|
||||||
include:
|
|
||||||
- docker-branch
|
# Specify the path to your docker-compose.yml
|
||||||
|
composeFile="$(find $(Build.SourcesDirectory) -name docker-compose.yml | head -1)"
|
||||||
|
|
||||||
|
# Check if a docker-compose.yml file was found
|
||||||
|
if [ -z "$composeFile" ]; then
|
||||||
|
echo "No docker-compose.yml file found in the workspace."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Log the path to the docker-compose.yml file
|
||||||
|
echo "Using docker-compose file at: $composeFile"
|
||||||
|
|
||||||
|
# Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD)
|
||||||
|
docker login dadeschoolscontainerregistry.azurecr.io -u ACR_USERNAME -p ACR_PASSWORD
|
||||||
|
|
||||||
|
# List of services to build, tag, and push
|
||||||
|
services=(
|
||||||
|
"damageassesmentapianswers"
|
||||||
|
"damageassesmentapiattachments"
|
||||||
|
"damageassesmentapiemployees"
|
||||||
|
"damageassesmentapilocations"
|
||||||
|
"damageassesmentapiquestions"
|
||||||
|
"damageassesmentapisurveys"
|
||||||
|
"damageassesmentapidoculinks"
|
||||||
|
"damageassesmentapiresponses"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Loop through the services and build, tag, and push
|
||||||
|
for service in "${services[@]}"; do
|
||||||
|
# Build the service
|
||||||
|
docker-compose -f "$composeFile" build "$service"
|
||||||
|
|
||||||
|
# Tag the image for ACR
|
||||||
|
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
|
||||||
|
|
||||||
|
# Push the image to ACR
|
||||||
|
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
|
||||||
|
done
|
||||||
|
displayName: 'Build and Push Docker Images'
|
||||||
|
env:
|
||||||
|
ACR_USERNAME: $(acrUsername) # Set your ACR username secret here
|
||||||
|
ACR_PASSWORD: $(acrPassword) # Set your ACR password secret here
|
||||||
|
Loading…
Reference in New Issue
Block a user