Skip to content

Instantly share code, notes, and snippets.

@smulvih2
Last active August 14, 2024 18:08
Show Gist options
  • Save smulvih2/f473295594fe71d117ebc041f6e4b7ef to your computer and use it in GitHub Desktop.
Save smulvih2/f473295594fe71d117ebc041f6e4b7ef to your computer and use it in GitHub Desktop.
Example Azure pipeline file for drupalwxt/docker-scaffold appsvc image
# Starter pipeline for the drupalwxt/docker-scaffold appsvc image
trigger:
tags:
include:
- '*'
pr: none
# Use a generic Ubuntu pool provided by Azure DevOps
pool:
vmImage: 'ubuntu-latest'
resources:
repositories:
- repository: site-XYZ
type: github
endpoint: XYZDrupalWxT
name: smulvih2/site-XYZ
variables:
- name: GIT_TAG
value: ''
steps:
- task: DockerInstaller@0
displayName: 'Update Docker'
inputs:
dockerVersion: '23.0.1'
releaseType: 'stable'
- bash: |
export GIT_TAG=$(echo $(Build.SourceBranch) | sed -e "s/^refs\/tags\///")
echo "Using git tag $GIT_TAG"
echo "##vso[task.setvariable variable=GIT_TAG]$GIT_TAG"
displayName: 'Export github tag name'
- checkout: site-XYZ
path: site-XYZ
displayName: 'Checkout XYZ application code'
- script: |
echo "Fetching tag " $(GIT_TAG)
git checkout $(GIT_TAG)
displayName: 'Switch git tag'
- script: export COMPOSER_MEMORY_LIMIT=-1 && composer install --ignore-platform-reqs
displayName: 'Install dependencies with composer'
- script: make build
displayName: 'Setup environment'
- script: |
docker compose -f docker-compose.appsvc.yml build --no-cache
docker compose -f docker-compose.appsvc.yml up -d
docker tag site-XYZ-web:latest $(XYZ_ACR_ENV)/site-XYZ:$(GIT_TAG)-appsvc
docker ps -a
sleep 10
displayName: 'Create and tag appsvc image'
env:
GIT_TAG: $(Build.SourceBranch)
- task: Docker@2
env:
GIT_TAG: $(Build.SourceBranch)
inputs:
command: 'push'
containerRegistry: 'Drupal ACR'
repository: 'site-XYZ'
tags: $(GIT_TAG)-appsvc
@smulvih2
Copy link
Author

You will need to create the corresponding Service Connections, for example, the Azure Container Registry "Drupal ACR".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment