简体   繁体   中英

How to pull composer install inside docker container for Jfrog artifcatory

PHP package are install through Jfrog artifact URL using composer.json file. Need to get PHP package using composer install command inside docker container. This docker container manage by Jenkins pipeline. WHen I am doing locally it asked username and password on terminal

vagrant@sandbox1-xxxxx.dev.roc [ application ]$ composer update
Loading composer repositories with package information
                                                      
    Authentication required (example.jfrog.io):
      Username: example
      Password: 
Do you want to store credentials for example.jfrog.io in /home/vagrant/.composer/auth.json ? [Yn] y

Then it stored auth value under /home/vagrant/.composer/auth.json similar thing need to do in docker while deployment. what is way to do this?

I got answer finally!

Jfrogtoken is configured under your Jenkins portal for token values.

Jenkins file you can add like this // withCredentials([string(credentialsId: 'Jfrogtoken', variable: 'secret')]) { jfrog_user = 'username'
jfrog_token = $secrete }

Pass this to docker file using --build-arg like

--build-arg jfrog_user=$jfrog_user --build-arg jfrog_token=$jfrog_token

Then you will received this params in Dockerfile under ARG value.

Then run this command before composer install . portal-url will be your jfrog account like example.jfrog.io

composer config --global http-basic.portal-url $jfrog_user $jfrog_token

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM