This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DCOS-44511] Add a Jenkinsfile for THE docker image (#2977)
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env groovy | ||
// Configuration for https://jenkins.mesosphere.com/service/jenkins/job/dcos-commons%20docker%20image/ | ||
pipeline { | ||
agent { | ||
label 'mesos' | ||
} | ||
|
||
environment { | ||
IMAGE = "dcos-commons" | ||
DOCKERFILE = "Dockerfile" | ||
|
||
// Get credentials for publishing to Docker hub. | ||
DOCKER = credentials('docker-hub-credentials') | ||
} | ||
|
||
stages { | ||
stage('docker login') { | ||
steps { | ||
// Login to the Docker registry. | ||
sh("docker login -u ${DOCKER_USR} -p ${DOCKER_PSW}") | ||
} | ||
} | ||
|
||
stage('build') { | ||
steps { | ||
// Build Docker image. | ||
sh("docker build -f ${DOCKERFILE} -t mesosphere/${IMAGE}:latest .") | ||
} | ||
} | ||
|
||
stage('publish') { | ||
// Only run this step on the master branch. | ||
when { | ||
branch 'master' | ||
} | ||
|
||
steps { | ||
script { | ||
sh("docker push mesosphere/${IMAGE}:latest") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters