Home > Enterprise >  php composer in Gitlab CI\CD docker runner
php composer in Gitlab CI\CD docker runner

Time:12-29

I install docker runner and try to run the next stage

build-dev:
      image: node:14.15.0-stretch
      stage: build
      script:
        - mkdir -p storage/framework/cache storage/framework/sessions storage/framework/testing storage/framework/views
        - /usr/bin/composer install --prefer-source --no-interaction
        - npm i
        - npm run prod
      artifacts:
        when: always
        name: $CI_COMMIT_SHA
        untracked: true
        paths:
          - tests/js/screens
          - tests/js/report
      cache:
        paths:
          - storage/framework
          - vendor
          - node_modules
          - public
      tags:
        - test_runner
      only:
        - ned_runner
    

but they returned next:

/bin/bash: line 129: /usr/bin/composer: No such file or directory

Can it happen because I use an image? And how I can resolve it? Because I don't have any idea how resolve it

CodePudding user response:

A Docker node image would not include composer directly.

You might want instead a PHP image (as in here), in which you install node, and composer.

Or a multi-stage built image in order to not install either node or PHP package (more than once) every time that you change your code.

Once you have build and published such an image, you will be able to use it in your gitlab-ci.yml.

  • Related