Skip to content

Commit

Permalink
Add Docker example to the README (jenkinsci#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Mar 12, 2023
1 parent 4116145 commit 9a00f72
Showing 1 changed file with 56 additions and 4 deletions.
60 changes: 56 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,66 @@ pipeline {

</details>

<details>
<summary>Docker</summary>

#### Preconditions
1. Populate 'DOCKER_REG_URL' with the Artifactory Docker registry, for example - 'acme.jfrog.io'.
2. To build the Docker image, install the "Docker Pipeline" on Jenkins.
```groovy
pipeline {
agent any
tools {
jfrog 'jfrog-cli'
}
environment {
DOCKER_IMAGE_NAME="$DOCKER_REG_URL/docker-local/hello-frog:1.0.0"
}
stages {
stage('Clone') {
steps {
git branch: 'master', url: "https://github.com/jfrog/project-examples.git"
}
}
stage ('Build Docker image') {
steps {
script {
docker.build("$DOCKER_IMAGE_NAME", 'docker-oci-examples/docker-example')
}
}
}
stage('Scan and push image') {
steps {
dir('docker-oci-examples/docker-example/') {
// Scan Docker image for vulnerabilities
jf 'docker scan $DOCKER_IMAGE_NAME'
// Push image to Artifactory
jf 'docker push $DOCKER_IMAGE_NAME'
}
}
}
stage('Publish build info') {
steps {
jf 'rt build-publish'
}
}
}
}
```
</details>

<details>
<summary>Maven</summary>

```groovy
pipeline {
agent any
tools {
jfrog 'cli'
jfrog 'jfrog-cli'
}
stages {
stage('Clone') {
Expand Down Expand Up @@ -276,7 +328,7 @@ pipeline {
pipeline {
agent any
tools {
jfrog 'cli'
jfrog 'jfrog-cli'
}
stages {
stage('Clone') {
Expand Down Expand Up @@ -314,7 +366,7 @@ pipeline {
pipeline {
agent any
tools {
jfrog 'cli'
jfrog 'jfrog-cli'
}
stages {
stage('Clone') {
Expand Down Expand Up @@ -356,7 +408,7 @@ pipeline {
pipeline {
agent any
tools {
jfrog 'cli'
jfrog 'jfrog-cli'
}
stages {
stage('Clone') {
Expand Down

0 comments on commit 9a00f72

Please sign in to comment.