building and pushing a docker image on nexus with concourse

736 Views Asked by At

I'm working on a concourse pipeline , and I would like to build and push a docker image on Nexus repository, but I can't find a concourse resource to use . I found this Concourse resource https://github.com/concourse/docker-image-resource but it's used to push a docker image on a Dockerhub repository with concourse , and that is not what I want. here is my resource concourse for nexus :

- name: nexus
  source:
    artifact: ((nameOfTheJar)):jar
    url: ((nexusUrl))
    username: ((nexusUser))
    password: ((nexusPassword))
    version_file: version/version
  type: maven-resource

do you think that we can use it to push a docker image in nexus? And here is the code to put on my nexus resource

- params:
      file: /build/libs/*.jar
      version_file: version/version
    put: nexus

I can't find a way to use those two codes for what I want. does anyone know a Concourse resource that can help me? Thank you

1

There are 1 best solutions below

4
On

Use the task defined here. It will build your image and output a tar file you could upload to nexus. Of course, if you require a JAR file as your question suggests, you could unpack and repack the tar as a jar in a subsequent task in the same job before uploading.