- Must have
Dockerfile
inside project, that able to rundocker built -t test:1.0.0 ./
- Image must be expose port as 80
- Image after build could run directly without any config file, config only accept to inject by environment variables
docker run -e "MYSQL_HOST=127.0.0.1" -e "MYSQL_USERNAME=root" test:1.0.0
- Must have Jenkins file follow this pattern
pipeline {
agent any
environment {
APP_NAME = 'your-application-frontend'
}
stages {
stage('Dockerize') {
when {
branch 'master'
}
steps {
script {
docker_image = docker.build("asia.gcr.io/docker-veep/${APP_NAME}", "./")
}
}
}
stage('Publish Docker') {
when {
branch 'master'
}
steps {
script {
docker.withRegistry('https://asia.gcr.io', 'gcr:docker-veep') {
docker_image.push("${env.BRANCH_NAME}-${env.BUILD_NUMBER}")
docker_image.push("latest")
}
}
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
build job: 'dm', parameters: [string(name: 'ENVIRONMENT', value: 'develop'), string(name: 'APP', value: "${APP_NAME}"), string(name: 'TAG', value: "${env.BRANCH_NAME}-${env.BUILD_NUMBER}")]
}
}
}
}
NOTE: change application-frontend
to your application name, eg: corperate-frontend, corperate-backend
- App must have endpoint for check health, typically it should be
GET /health
, that return status 200 and text isOK