This project is a code sample to show you how to create a Webhook handler for Artifactory. Here is the related blog post
Server is the code snippet for the web application we want to update. It's written in golang. There is 2 files :
- serve.go : the simple http server
- Dockerfile : the Dockerfile for building an image for this web app
Webhook is the code snippet for updating the running docker image of the web app :
- serve.go : the webhook handler
You can run it with
go run serve.go
here are the command for running this example
Run artifactory locally
docker run -p 8082:8082 docker.bintray.io/jfrog/artifactory-pro:latest
(here you need to setup artifactory repository and webhook, install Jfrog CLI, follow the instructions in the blog post)
Build the image
(cd server && docker build . -t localhost:8082/docker-local-staging/helloworld)
Push image to artifactory
jfrog rt docker-push localhost:8082/docker-local-staging/helloworld docker-local-staging --url http://localhost:8082/artifactory --user admin --password password
Promote the image
jfrog rt docker-promote helloworld docker-local-staging docker-local-prod --user admin --password password --url http://localhost:8082/artifactory --copy