Skip to content

Commit

Permalink
Adding pipeline files (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
andr0272 authored Dec 15, 2023
1 parent 5e25240 commit 24f8ad4
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .azuredevops/build-and-push-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
trigger:
- develop

pr: none

variables:
azureContainerRegistry.repository: 'oas/eligibility-estimator'
azureContainerRegistry.name: 'DTSShared-December/2023'
azureContainerRegistry.domain: 'dtsshared.azurecr.io'
app.environment: development
app.buildDate: $[ format('{0:yyyy}-{0:MM}-{0:dd}', pipeline.startTime) ]
app.domain: 'https://app-eligibilityestimator-dev.azurewebsites.net/'
app.logLevel: 'info'
image.tag: 'oas/$(Build.SourceVersion)'
System.Debug: false

stages:
- stage: Cache
displayName: Pull latest image for caching
jobs:
- job:
displayName: Pull latest image
steps:
- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'login'

- script: 'docker pull $(azureContainerRegistry.domain)/$(azureContainerRegistry.repository):latest'
displayName: Pull latest for layer caching
continueOnError: true

- stage: Build
displayName: Build and Push to ACR
jobs:
- job: Build
displayName: Build and Push Container
steps:
- task: AzureKeyVault@2
inputs:
azureSubscription: 'id-eligibilityestimator-dev'
KeyVaultName: 'kv-oas-ee-dev'
SecretsFilter: 'DEV-ADOBE-ANALYTICS-URL, NEXT-AUTH-PASSWORD, NEXT-AUTH-USERCODE'
RunAsPreJob: false

- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'build'
Dockerfile: './Dockerfile'
tags: |
$(image.tag)
latest
release-candidate
arguments: |
--pull
--cache-from $(azureContainerRegistry.domain)/$(azureContainerRegistry.repository):latest
--build-arg home=/app
--build-arg NEXT_BUILD_DATE=$(app.buildDate)
--build-arg NEXTAUTH_URL=$(app.domain)
--build-arg NEXT_AUTH_USERNAME=$(NEXT_AUTH_USERCODE)
--build-arg NEXT_AUTH_PASSWORD=$(NEXT_AUTH_PASSWORD)
--build-arg NEXTAUTH_SECRET=$(NEXT_AUTH_SECRET)
--build-arg ADOBE_ANALYTICS_URL=$(DEV-ADOBE-ANALYTICS-URL)
--build-arg APP_ENV=$(app.environment)
--build-arg LOGGING_LEVEL=$(app.logLevel)
- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'push'
tags: |
$(image.tag)
latest
release-candidate
74 changes: 74 additions & 0 deletions .azuredevops/build-and-push-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
trigger:
- main

pr: none

variables:
azureContainerRegistry.repository: 'oas/eligibility-estimator'
azureContainerRegistry.name: 'DTSShared-December/2023'
azureContainerRegistry.domain: 'dtsshared.azurecr.io'
app.environment: production
app.buildDate: $[ format('{0:yyyy}-{0:MM}-{0:dd}', pipeline.startTime) ]
image.tag: 'oas/$(Build.SourceVersion)'

stages:
- stage: Cache
displayName: Pull latest image for caching
jobs:
- job:
displayName: Pull latest image
steps:
- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'login'

- script: 'docker pull $(azureContainerRegistry.domain)/$(azureContainerRegistry.repository):latest'
displayName: Pull latest for layer caching
continueOnError: true
- stage: Build
displayName: Build and Push to ACR
jobs:
- job: Build
displayName: Build and Push Container
steps:
- task: AzureKeyVault@2
inputs:
azureSubscription: 'id-eligibilityestimator-prod'
KeyVaultName: 'kv-oas-ee-prod'
SecretsFilter: 'PROD-ADOBE-ANALYTICS-URL'
RunAsPreJob: false

- script: 'docker pull $(azureContainerRegistry.domain)/$(azureContainerRegistry.repository):latest'
displayName: Pull latest for layer caching
continueOnError: true

- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'build'
Dockerfile: './Dockerfile'
tags: |
$(image.tag)
latest
production-release
arguments: |
--pull
--cache-from $(azureContainerRegistry.domain)/$(azureContainerRegistry.repository):latest
--build-arg home=/app
--build-arg NEXT_BUILD_DATE=$(app.buildDate)
--build-arg ADOBE_ANALYTICS_URL=$(DEV-ADOBE-ANALYTICS-URL)
--build-arg APP_ENV=$(app.environment)
--build-arg LOGGING_LEVEL=$(app.logLevel)
- task: Docker@2
inputs:
containerRegistry: '$(azureContainerRegistry.name)'
repository: '$(azureContainerRegistry.repository)'
command: 'push'
tags: |
$(image.tag)
latest
release-candidate

0 comments on commit 24f8ad4

Please sign in to comment.