- Set npm command line client to work with Artifactory Npm Registry.
create.npmrc
file and paste following content to it:registry = https://$ARTIFACTORY_URL/api/npm/$ARTIFACTORY_NPM_REPO_NAME/ _auth = $ARTIFACTORY_USER:$ARTIFACTORY_PASSWORD email = youremail@email.com always-auth = true
- Install dependencies:
npm install
- Start node Server:
npm start
- Access Application on: http://localhost:3000
- Build docker image:
docker build -t $DOCKER_REGISTRY/node-version .
- Run docker container:
docker run -d -p 3000:3000 $DOCKER_REGISTRY/node-version
- Login to Artifactory docker registry:
docker login -u ARTIFACTORY_USER -p $ARTIFACTORY_PASSWORD $DOCKER_REGISTRY
- Push docker image:
docker push $DOCKER_REGISTRY/node-version
Note: List of required Jenkins plugins
-
On the Jenkins front page, click on Credentials -> System -> Global credentials -> Add Credentials
-
Add your Artifactory credentials as the type Username with password, with the ID artifactory-credentials
-
Add String Parameters:
- ART_SERVER_URL : Artifactory Server URL
e.gART_SERVER_URL : https://jfrogtraining.jfrog.io/jfrogtraining
- ART_DOCKER_REGISTRY -> Artifactory Docker Registry name
e.g.ART_DOCKER_REGISTRY -> jfrogtraining-docker-dev.jfrog.io
- CREDENTIAL_ID : Artifactory Credentials Id created in 4th step
e.g.CREDENTIAL_ID -> artifactory-credentials
- ART_SERVER_URL : Artifactory Server URL
-
Create new Jenkins Pipeline Job.
-
Copy Jenkinsfile to Pipeline Script.
-
To build it, press Build Now. After a few minutes you should see an image appear in your Artifactory repository, and something like this on the page of your new Jenkins job:
- Create new Jenkins Pipeline Job.
- Copy Jenkinsfile to Pipeline Script.
- To build it, press Build Now.