RobLoach / docker-composer

:ok_woman: Docker container to install and run Composer.
https://hub.docker.com/r/library/composer/
Other
104 stars 49 forks source link

Container does not work in Gitlab CI Runner #91

Open derhasi opened 8 years ago

derhasi commented 8 years ago

When trying to use composer/composer:php5-alpine in Gitlab CI, there is some odd error occuring:

The .gitlab-ci.yml looks like this:

image: composer/composer:php5-alpine
stages:
  - build
  - test
  - deploy
# Jobs
satis-build:
  stage: build
  script:
    - ls

and creates a build output like this:

gitlab-ci-multi-runner 1.3.2 (0323456)
Using Docker executor with image composer/composer:php5-alpine ...
Pulling docker image composer/composer:php5-alpine ...
Running on runner-420782f7-project-64-concurrent-0 via build-runner-githost...
Fetching changes...
HEAD is now at 8d19828 More tests
From https://gitlab.undpaul.de/undpaul/packages
   8d19828..9141eee  master     -> origin/master
Checking out 9141eee5 as master...

  [Symfony\Component\Console\Exception\RuntimeException]  
  The "-c" option does not exist.                         

show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-D|--direct] [--] [<package>] [<version>]

  [Symfony\Component\Console\Exception\RuntimeException]  
  The "-c" option does not exist.                         

show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-D|--direct] [--] [<package>] [<version>]

ERROR: Build failed: exit code 1
RobLoach commented 8 years ago

Interesting, perhaps it's running a show command with -c in there?

sylus commented 8 years ago

I am successfully using this container in a Drone CI setup, so I am thinking GitLab is most assuredly doing something funky here ^_^

derhasi commented 8 years ago

It has to be project independent, as I run the same .gitlab-ci.yml on an empty project. The only "script" that is/will be called is ls. So I do not know where the composer show command is coming from.

cconover commented 8 years ago

I'm seeing this same issue. This is all I have for the composer part of my build:

composer:
    stage: build
    image: composer/composer
    artifacts:
        paths:
            - vendor/
    cache:
        key: "$CI_BUILD_REF_NAME"
        paths:
            - vendor/
    script:
        - install --prefer-dist
fbourigault commented 8 years ago

gitlab-ci requires that used images provide a shell entry point as the runner build a bash script to be run into the container.

BastienM commented 7 years ago

IMO it is Gitlab-CI that should adapts itself to how Docker image works and not the other way around.

Most of the available images uses a CMD directive pointing directly to a binary and you cannot asks for every single one of them to changes this behavior in order to be compliant to how Gitlab-CI works.

On that matter, there is still an opened discussion on their repo.

For now the best approach to solve this problem would be to create a new image with composer as its base and change the entrypoint by a script as stated in the PR #116.

fetzerch commented 6 years ago

Even though the project is discontinued: Starting with GitLab (Runner) 9.4 it is possible to override the entrypoint:

image:
    name: composer/composer:php5-alpine
    entrypoint: [""]

so that the image can be used with GitLab CI.