Compare commits

...

5 Commits

Author SHA1 Message Date
Santhosh Nair
0826c50a1e Update azure-pipelines.yml for Azure Pipelines 2023-09-12 03:38:00 +00:00
Santhosh Nair
37fee2121c Update azure-pipelines.yml for Azure Pipelines 2023-09-12 03:24:41 +00:00
Santhosh Nair
7365fb08d3 Update azure-pipelines.yml for Azure Pipelines 2023-09-12 03:17:37 +00:00
Santhosh Nair
0c37b87d43 Update azure-pipelines.yml Project path 2023-08-31 00:02:57 +00:00
Santhosh Nair
bfdcba0935 Set up CI with Azure Pipelines
[skip ci]
2023-08-30 23:56:00 +00:00

71
azure-pipelines.yml Normal file
View File

@ -0,0 +1,71 @@
trigger:
- docker-branch # Trigger the pipeline on pushes to the main branch. Adjust the branch name as needed.
pr:
- '*' # Include pull requests.
pool:
vmImage: 'ubuntu-latest' # Use the latest Ubuntu image.
variables:
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:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
- script: |
# 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
docker push $(DOCKER_IMAGE_ANSWERS)
# Build and push the attachments-api Docker image
docker build -t $(DOCKER_IMAGE_ATTACHMENTS) ./DamageAssesment.Api.Attachments
docker push $(DOCKER_IMAGE_ATTACHMENTS)
# 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 locations-api Docker image
docker build -t $(DOCKER_IMAGE_LOCATIONS) ./DamageAssesment.Api.Locations
docker push $(DOCKER_IMAGE_LOCATIONS)
# 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 surveys-api Docker image
docker build -t $(DOCKER_IMAGE_SURVEYS) ./DamageAssesment.Api.Surveys
docker push $(DOCKER_IMAGE_SURVEYS)
# 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'
- script: |
# Deploy your services using Docker Compose
docker-compose -f docker-compose.yml up -d --build
displayName: 'Deploy with Docker Compose'
- script: |
# Cleanup: Stop and remove Docker containers
docker-compose -f docker-compose.yml down
displayName: 'Cleanup Docker Containers'