Hello, I'm in internship trying to learn how to become a cloud administrator (DevOps). To do that I practice and try to deploy resources with different tools to learn the basics, the best practises and so much more.
I decided to try Azure DevOps Pipelines in order to deploy GLPI with its database on a AKS cluster. I successfully created my project (my code is stored on GitHub) and the necessary services connections Kubernetes (with KubeConfig) and Docker for my pipeline.
I had no issue deploying my aks cluster with .yaml files with kubectl commands on the azure Cloud Shell.
Now I want to use Pipelines to build and push my GLPI image to a Docker repository I created. I variabilize and as I have a .env file for GLPI I use the commands build
and push
separately.
Now when I run my pipeline I get the following error : ##[error]Unhandled: No Dockerfile matching /home/vsts/work/1/s/Dockerfile_glpi_v1 was found
.
I checked so many posts about this error to understand and finally tried to use buildContext: (Build.SourcesDirectory)
however the issue persists. I checked my directory with pwd
and got as a result : /home/vsts/work/1/s
.
My pipeline code is the following :
trigger:
batch: true
branches:
include:
- main
paths:
include:
- azure-pipelines.yml
pool:
vmImage: ubuntu-latest
resources:
- repo: self
variables:
imageRepository1: 'dunvael/glpi_v10.0.7'
dockerfilePath1: './Dockerfile_glpi_v1'
kubernetesServiceEndpoint: 'KubernetesConnection'
envFilePath1: './mariadb-glpi-one.env'
# Build the docker image
stages:
- stage: Build
jobs:
- job: BuildAndPush
displayName: 'Build and Push the Docker image to DockerHub'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
echo "Current working directory: $(pwd)"
displayName: Print Current Working Directory
- task: Docker@2
inputs:
containerRegistry: 'DockerHubConnection'
repository: $(imageRepository1)
Dockerfile: $(dockerfilePath1)
buildContext: $(Build.SourcesDirectory) # Set the build context to the root of the repository => telling Azure DevOps to use the root directory of my source code repository as the context for building the Docker image
command: build
arguments: '--build-arg ENV_FILE_PATH=$(envFilePath1)'
tags: 'latest'
- task: Docker@2
inputs:
containerRegistry: 'DockerHubConnection'
repository: $(imageRepository1)
Dockerfile: $(dockerfilePath1)
command: push
# Admin acknowledgement 1
- stage: AdminVal
displayName: 'Admin Validation'
dependsOn: Build
jobs:
- job: waitForValidation
displayName: Wait for external validation
pool: server
timeoutInMinutes: 1440 # job times out in 3 days
steps:
- task: ManualValidation@0
timeoutInMinutes: 120 # task times out in 1 day
inputs:
notifyUsers: |
******@gmail.com
instructions: 'Glpi V1 image build and push to Docker repository failed. Do you want to continue?'
onTimeout: 'reject'
# Deploy to cluster AKS
- stage: DeployAKS
dependsOn: AdminVal
jobs:
- job: GLPIdeploy
displayName: 'Deploy Glpi image to AKS'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
echo "Current working directory: $(pwd)"
displayName: Print Current Working Directory
- task: Kubernetes@1
displayName: Deploy to AKS
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: '$(kubernetesServiceEndpoint)'
namespace: 'glpi'
command: 'apply'
arguments: '-f ./infra/cluster/glpi_v1.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'
dockerRegistryEndpoint: 'DockerHubConnection'
- script: |
echo "Current working directory: $(pwd)"
displayName: Print Current Working Directory
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: $(kubernetesServiceEndpoint)
namespace: 'glpi'
command: 'login'
# The following task executes the infra_creation.sh script in a Bash shell and will allow users to interact with the prompts when the script runs
- task: Bash@3
inputs:
filePath: './infra/cluster/infra_creation.sh'
# Test GLPI v1 service
- stage: Testv1
dependsOn: DeployAKS
jobs:
- job: TestV1Service
displayName: 'Test Glpi V1 Service'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
curl https://glpi-v1.xxxxx.xxxxx/
displayName: Test Glpi V1 Service with curl
# Signout
- stage: SignOut
dependsOn: Testv1
jobs:
- job: SigningOut
displayName: 'Signing Out'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: CmdLine@2
inputs:
script: |
echo Thank you for using Azure DevOps Pipeline.
echo
echo Have a good day !
The path of my Dockerfile_glpi_v1 (I use VS Code to push it to GitHub) is : Projet > Projet_fil_rouge_GLPI
There are several dockerfiles and .env file because I wish to deploy several versions of GLPI but I start with only one first.

Could you please enlighten me ? I apologize if this is because of my inexperience or a mistake on my part.
Thank you very much.