We will use vfc-nfvo-lcm(python project) as a sample to describle how to build docker image for vfc components.

  1. write a Dockerfile
    1) create a directory named docker in base repo( you can ref to vfc/nfvo/lcm/docker )
    2) In the docker directory, you need add the following files( you can ref to vfc/nfvo/lcm/docker/* )
        build_image.sh     note: the file is called by script in jjb of ci-management, variable IMAGE should be microservice name.
        docker-entrypoint.sh   note: the file is used as ENTRYPOINT of Dockerfile
        Dockerfile   note: the file is used by docker build command(if the repo is a java project, you should add jdk and tomcat in apt-get install)
       instance_config.sh  note: this file is called by docker-entrypoint.sh to config parameters when docker is created.
       instance_init.sh   note: this file is called by docker-entrypoint.sh to do one-time initialization when docker is created.
       instance_run.sh  note: this file is called by docker-entrypoint.sh to start your service when docker is created.
       LICENSE note: because we do not add license header in the above sh files, so we need add this license file.
       note: a) before you commit your file, you should use "git update-index --chmod=+x <file>" command to add execute permission to the above sh files.
                    and you can use "git ls-files --stage <file>" to confirm the <file>'s execute permission.(note 100755 is ok, while 100644 is not ok)
                b) run_image.sh and remove_image.sh are used to run and remove docker image, and are not essential for building docker image.    
    3) upate assembly.xml, add docker directory to binary zip( you can ref to vfc/nfvo/lcm/assembly.xml

            <fileSet>
                <directory>docker</directory>
                <outputDirectory>/docker</outputDirectory>
                <includes>
                    <include>*.sh</include>
                    <include>Dockerfile</include>
                </includes>
            </fileSet>

  2. create jjb in ci-management
    1) enter ci-management/jjb/vfc
    2) add build-<name>-docker-image.sh( you can ref to build-nfvo-lcm-docker-image.sh, note we need add execute permission to it in gerrit)
    3) add docker-java-version-shell-daily to yaml file( you can ref to vfc-nfvo-lcm-java.yaml)
       - '{project-name}-{stream}-docker-java-version-shell-daily':

          docker-pom: 'pom.xml' 
          mvn-goals: 'install'
          script:
              !include-raw-escape: 'build-nfvo-lcm-docker-image.sh'  
    Note:  a) we use docker-java-version-shell-daily template to do our docker image build, if you want use docker-java-version-daily template, 

                  you will need write a pom file.(you can ref to multi-cloud project)
              b) because docker-java-version-shell-daily template does not support {subproject}, those repo which has subproject needs add a pom file to root repo.

                  ( you can ref to vfc/gvnfm/vnflcm )

  3. Add a version.properties file in your base repo(ref to vfc/nfvo/lcm/version.properties)
    Note: Those repo which has subproject needs to add version.properties to base repo.(you can ref to vfc/gvnfm/vnflcm)
  4. execute docker-java-version-shell-daily job immediately
    Enter "please release" in your reply to your commit in gerrit.
  5. confirm docker file in nexus3.onap.org
    Open https://nexus3.onap.org and input your image name in the "Search components" text box. ref the following:



  • No labels