JulienBreux / phpunit-docker

DEPRECATED :package: Docker image to use PHPUnit as CLI.
https://hub.docker.com/r/phpunit/phpunit/
MIT License
47 stars 28 forks source link

Can not skip ONBUILD step #56

Closed gadelkareem closed 7 years ago

gadelkareem commented 7 years ago

I am getting this error

Sending build context to Docker daemon  2.56 kB
Step 1/4 : FROM phpunit/phpunit
# Executing 1 build trigger...
Step 1/1 : RUN pear install $PEAR_PACKAGES
 ---> Running in 9348bfdb902d
No releases available for package "pear.php.net/foo"
install failed
The command '/bin/sh -c pear install $PEAR_PACKAGES' returned a non-zero code: 1
chrisshennan commented 7 years ago

I'm seeing the same issue when I'm trying to create a new image based off of the phpunit/phpunit docker image.

I can see the ENV PEAR_PACKAGES foo and ONBUILD RUN pear install $PEAR_PACKAGES lines were added when the 5.7.0 tags where merged and doesn't exist on the earlier tags 5.5.0 and below

@JulienBreux Any ideas?

JulienBreux commented 7 years ago

Okey guys, I fix that ASAP with a if.

ONBUILD RUN [ $PEAR_PACKAGES != "foo" ] && pear install $PEAR_PACKAGES

JulienBreux commented 7 years ago

It's done :)

rousku commented 7 years ago

This is not yet fixed.

# Executing 1 build trigger...
Step 1/1 : RUN [ $PEAR_PACKAGES != "foo" ] && pear install $PEAR_PACKAGES
 ---> Running in 9451059aae7e
The command '/bin/sh -c [ $PEAR_PACKAGES != "foo" ] && pear install $PEAR_PACKAGES' returned a non-zero code: 1

If PEAR_PACKAGES equals "foo" expression [ $PEAR_PACKAGES != "foo" ] returns 1.

Correct fix would be:

RUN [ $PEAR_PACKAGES != "foo" ] || exit 0 && pear install $PEAR_PACKAGES

JulienBreux commented 7 years ago

Excacly, @rousku a ... PR ? << :D

VRciF commented 6 years ago

I got this error too, using the following Dockerfile:

FROM phpunit/phpunit

RUN echo "hello world"

The error is

Building phpunit
Step 1/2 : FROM phpunit/phpunit
# Executing 1 build trigger
 ---> Running in 68128fd92689
/bin/sh: syntax error: unexpected end of file (expecting "}")
ERROR: Service 'phpunit' failed to build: The command '/bin/sh -c {         [ "${PEAR_PACKAGES}" != "foo" ]     } || exit 0 && pear install ${PEAR_PACKAGES}' returned a non-zero code: 2

if i put the line in a separate file just for testing like 'test.sh':

#!/bin/bash

/bin/sh -c '{         [ "${PEAR_PACKAGES}" != "foo" ]     } || exit 0 && pear install ${PEAR_PACKAGES}'

i get the same error message as noted above. To be honest, i dont see the problem here, and if i copy the original phpunit dockerfile and build it, it works.

@JulienBreux Would you be so kind to check if you can reproduce the problem with the Dockerfile given above?

philippefuentes commented 6 years ago

I got exactly the same problem as you @VRciF ...

Step 1/2 : FROM phpunit/phpunit:latest
# Executing 1 build trigger
 ---> Running in 0256df07ae1f
/bin/sh: syntax error: unexpected end of file (expecting "}")
ERROR: Service 'vma-phpunit-debug' failed to build: The command '/bin/sh -c {         [ "${PEAR_PACKAGES}" != "foo" ]     } || exit 0 && pear install ${PEAR_PACKAGES}' returned a non-zero code: 2
rousku commented 6 years ago

This issue has been addressed in #77. Pull request #83 fixes the issue.