Update azure-pipelines.yml for Azure Pipelines

This commit is contained in:
Santhosh Nair 2023-09-12 03:38:00 +00:00
parent 37fee2121c
commit 0826c50a1e

View File

@ -8,13 +8,14 @@ pool:
vmImage: 'ubuntu-latest' # Use the latest Ubuntu image.
variables:
DOCKER_IMAGE_ANSWERS: 'santhoshsnair/answers-api'
DOCKER_IMAGE_ATTACHMENTS: 'anthoshsnair/attachments-api'
DOCKER_IMAGE_EMPLOYEES: 'anthoshsnair/employee-api'
DOCKER_IMAGE_LOCATIONS: 'anthoshsnair/locations-api'
DOCKER_IMAGE_QUESTIONS: 'anthoshsnair/questions-api'
DOCKER_IMAGE_SURVEYS: 'anthoshsnair/surveys-api'
DOCKER_IMAGE_SURVEYRESPONSE: 'anthoshsnair/surveyresponse-api'
DOCKER_IMAGE_ANSWERS: 'your-docker-username/answers-api'
DOCKER_IMAGE_ATTACHMENTS: 'your-docker-username/attachments-api'
DOCKER_IMAGE_EMPLOYEES: 'your-docker-username/employee-api'
DOCKER_IMAGE_LOCATIONS: 'your-docker-username/locations-api'
DOCKER_IMAGE_QUESTIONS: 'your-docker-username/questions-api'
DOCKER_IMAGE_SURVEYS: 'your-docker-username/surveys-api'
DOCKER_IMAGE_SURVEYRESPONSE: 'your-docker-username/surveyresponse-api'
jobs:
- job: BuildAndDeploy
steps:
@ -26,8 +27,8 @@ jobs:
addToPath: true
- script: |
# Log in to Docker Hub using secrets
docker login -u $(DOCKERHUB_USERNAME_SECRET) -p $(DOCKERHUB_PASSWORD_SECRET)
# Log in to Docker Hub using the service connection
docker login -u $(dockerHubCon.username) -p $(dockerHubCon.password)
# Build and push the answers-api Docker image
docker build -t $(DOCKER_IMAGE_ANSWERS) ./DamageAssesment.Api.Answers
@ -37,35 +38,28 @@ jobs:
docker build -t $(DOCKER_IMAGE_ATTACHMENTS) ./DamageAssesment.Api.Attachments
docker push $(DOCKER_IMAGE_ATTACHMENTS)
# Build and push the attachments-api Docker image
# Build and push the employees-api Docker image
docker build -t $(DOCKER_IMAGE_EMPLOYEES) ./DamageAssesment.Api.Employees
docker push $(DOCKER_IMAGE_EMPLOYEES)
# Build and push the attachments-api Docker image
# Build and push the locations-api Docker image
docker build -t $(DOCKER_IMAGE_LOCATIONS) ./DamageAssesment.Api.Locations
docker push $(DOCKER_IMAGE_LOCATIONS)
# Build and push the attachments-api Docker image
# Build and push the questions-api Docker image
docker build -t $(DOCKER_IMAGE_QUESTIONS) ./DamageAssesment.Api.Questions
docker push $(DOCKER_IMAGE_QUESTIONS)
#Build and push the attachments-api Docker image
# Build and push the surveys-api Docker image
docker build -t $(DOCKER_IMAGE_SURVEYS) ./DamageAssesment.Api.Surveys
docker push $(DOCKER_IMAGE_SURVEYS)
#Build and push the attachments-api Docker image
# Build and push the surveyresponse-api Docker image
docker build -t $(DOCKER_IMAGE_SURVEYRESPONSE) ./DamageAssesment.Api.SurveyResponses
docker push $(DOCKER_IMAGE_SURVEYRESPONSE)
displayName: 'Build and Push Docker Images'
env:
DOCKER_IMAGE_ANSWERS: $(DOCKER_IMAGE_ANSWERS)
DOCKER_IMAGE_ATTACHMENTS: $(DOCKER_IMAGE_ATTACHMENTS)
DOCKER_IMAGE_EMPLOYEES: $(DOCKER_IMAGE_EMPLOYEES)
DOCKER_IMAGE_LOCATIONS: $(DOCKER_IMAGE_LOCATIONS)
DOCKER_IMAGE_QUESTIONS: $(DOCKER_IMAGE_QUESTIONS)
DOCKER_IMAGE_SURVEYS: $(DOCKER_IMAGE_SURVEYS)
DOCKER_IMAGE_SURVEYRESPONSE: $(DOCKER_IMAGE_SURVEYRESPONSE)
- script: |
# Deploy your services using Docker Compose
docker-compose -f docker-compose.yml up -d --build