diff --git a/CDpipeline.yml b/CDpipeline.yml new file mode 100644 index 00000000..dc0507cd --- /dev/null +++ b/CDpipeline.yml @@ -0,0 +1,32 @@ +trigger: +- none + +resources: + pipelines: + - pipeline: BuildPipeline # Reference to the build pipeline that creates the artifact + source: 'Salmanjutt79.two-tier-flask-app' # Name of the build pipeline + trigger: true # Automatically trigger on new builds + +stages: +- stage: Deploy + displayName: Deploy Docker Compose + jobs: + - job: Deploy + displayName: Deploy + pool: + name: Default + steps: + - download: BuildPipeline # Download the artifact from the build pipeline + artifact: 'docker-compose-artifact' # Name of the artifact published by the build pipeline + + + - task: DockerCompose@0 + displayName: Deploy with Docker Compose + inputs: + action: 'Run services' + dockerComposeFile: '/home/worker/myagent/_work/5/BuildPipeline/docker-compose-artifact/docker-compose.yml' + projectName: 'flaskapp' # Replace with your project name if necessary + dockerRegistryEndpoint: 'Dockerhub-connection' # Specify your Docker registry connection here + additionalImageTags: | + $(tag) + dockerComposePath: '/usr/local/bin/docker-compose' diff --git a/Cd pipelineiamges.yml b/Cd pipelineiamges.yml new file mode 100644 index 00000000..67a2f5ca --- /dev/null +++ b/Cd pipelineiamges.yml @@ -0,0 +1,28 @@ +trigger: +- master + +pool: + name: 'Default' + +steps: +- task: DownloadBuildArtifacts@0 + displayName: 'Download Docker images artifact' + inputs: + buildType: 'specific' + project: '$(System.TeamProjectId)' + pipeline: 'Salmanjutt79.two-tier-flask-app (2)' # Replace with the name of your CI pipeline + buildVersionToDownload: 'latest' + downloadPath: '$(System.ArtifactsDirectory)/docker-images' + artifactName: 'docker-images' + +- task: DockerCompose@0 + displayName: 'Deploy Docker images' + inputs: + action: 'Run services' + dockerComposeFile: 'docker-compose.yml' + projectName: 'myapp' + + additionalImageTags: 'latest' + containerRegistryType: 'Container Registry' + dockerRegistryEndpoint: 'Dockerhub-connection' + #artifactName: 'docker-images' # Replace with your Docker registry connection name diff --git a/Dockerfile1 b/Dockerfile1 new file mode 100644 index 00000000..50f9be2f --- /dev/null +++ b/Dockerfile1 @@ -0,0 +1,13 @@ +# Use the official MySQL 5.7 image as the base image +FROM mysql:5.7 + +# Set environment variables +ENV MYSQL_DATABASE=mydb +ENV MYSQL_USER=root +ENV MYSQL_ROOT_PASSWORD=admin + +# Expose port 3306 to allow external connections +EXPOSE 3306 + +# Start MySQL server +CMD ["mysqld"] diff --git a/app.py b/app.py index 48c9113f..adea55d9 100644 --- a/app.py +++ b/app.py @@ -33,3 +33,5 @@ def submit(): if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True) +#update app.py fiile + diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 00000000..167c0d1f --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,21 @@ +trigger: +- master + +pool: + name: 'Default' + +steps: +- task: DockerCompose@0 + displayName: 'Build Docker images' + inputs: + action: 'Build services' + dockerComposeFile: 'docker-compose.yml' + additionalImageTags: 'latest' + + projectName: 'myapp' + +- task: PublishBuildArtifacts@1 + displayName: 'Publish Docker images as artifacts' + inputs: + PathtoPublish: '$(Build.SourcesDirectory)' + ArtifactName: 'docker-images' diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1 @@ +