edbizarro / gitlab-ci-pipeline-php

:coffee: Docker images for test PHP applications with Gitlab CI (or any other CI platform!)
https://hub.docker.com/r/edbizarro/gitlab-ci-pipeline-php
MIT License
529 stars 167 forks source link

Invalid option name: set: pipefail #110

Open hanstsangcwc opened 3 years ago

hanstsangcwc commented 3 years ago

trying to build php image but not working.

PS C:\code\gitlab-ci-pipeline-php> docker build --compress -f php/7.4/Dockerfile .
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=php%2F7.4%2FDockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=qe9ysrmr6vvmzvuvwqe8i2wyk&shmsize=0&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
PS C:\code\gitlab-ci-pipeline-php> docker build --compress -f php/7.4/Dockerfile .
Sending build context to Docker daemon  6.079kB
Step 1/18 : FROM php:7.4
7.4: Pulling from library/php
bb79b6b2107f: Pull complete
80f7a64e4b25: Pull complete
da391f3e81f0: Pull complete
8199ae3052e1: Pull complete
06bd7d815b87: Pull complete
0b3dde639b22: Pull complete
0d2baf28aa11: Pull complete
97a00bacf13c: Pull complete
3066b2d21161: Pull complete
Digest: sha256:edf6ecb356d76e0be95f61f4e79ac40515b9af8f15d0e916953492fb65a33c0a
Status: Downloaded newer image for php:7.4
 ---> f4f453029716
Step 2/18 : ARG BUILD_DATE
 ---> Running in 6a14add9bd3d
Removing intermediate container 6a14add9bd3d
 ---> a9bb9be55b72
Step 3/18 : ARG VCS_REF
 ---> Running in af0094cb3811
Removing intermediate container af0094cb3811
 ---> 256f85f88b2d
Step 4/18 : LABEL maintainer="Eduardo Bizarro <edbizarro@gmail.com>"   PHP="7.4"   NODE="14"   org.label-schema.name="edbizarro/gitlab-ci-pipeline-php"   org.label-schema.description=":coffee: Docker images for build and test PHP applications with Gitlab CI (or any other CI plataform!)"   org.label-schema.build-date=$BUILD_DATE   org.label-schema.schema-version="1.0"   org.label-schema.vcs-url="https://github.com/edbizarro/gitlab-ci-pipeline-php"   org.label-schema.vcs-ref=$VCS_REF
 ---> Running in 87168ffbcb6f
Removing intermediate container 87168ffbcb6f
 ---> 95544d88e7c4
Step 5/18 : ENV IMAGE_USER=php
 ---> Running in a14a7942383d
Removing intermediate container a14a7942383d
 ---> 21aecc1470ad
Step 6/18 : ENV HOME=/home/$IMAGE_USER
 ---> Running in ad046c3aec4b
Removing intermediate container ad046c3aec4b
 ---> 4bce20dcd7ca
Step 7/18 : ENV COMPOSER_HOME=$HOME/.composer
 ---> Running in 65ca5db7f084
Removing intermediate container 65ca5db7f084
 ---> 0e8bbf378337
Step 8/18 : ENV PATH=$HOME/.yarn/bin:$PATH
 ---> Running in 522d031aa2e4
Removing intermediate container 522d031aa2e4
 ---> 0cc901dc6c73
Step 9/18 : ENV GOSS_VERSION="0.3.8"
 ---> Running in d0243849d9e6
Removing intermediate container d0243849d9e6
 ---> 5c2f932de19d
Step 10/18 : ENV PHP_VERSION=7.4
 ---> Running in 8464b4213ded
Removing intermediate container 8464b4213ded
 ---> 919aa1719be0
Step 11/18 : USER root
 ---> Running in 657dd7646420
Removing intermediate container 657dd7646420
 ---> 5652b78204f2
Step 12/18 : WORKDIR /tmp
 ---> Running in e14f7786a643
Removing intermediate container e14f7786a643
 ---> 8ef7e154ba04
Step 13/18 : COPY --from=composer:1 /usr/bin/composer /usr/bin/composer
1: Pulling from library/composer
188c0c94c7c5: Pull complete
45f8bf6cfdbe: Pull complete
ce5be7974012: Pull complete
a99dd6507fe5: Pull complete
84ab7a98c2ef: Pull complete
07fa46c284ad: Pull complete
7ae9397c88ea: Pull complete
5e4748577090: Pull complete
36fcf1c47c04: Pull complete
0e7ab985a9bd: Pull complete
587323d75f78: Pull complete
5d927604c025: Pull complete
c18a39bfedf9: Pull complete
75dfe5229db8: Pull complete
33c89e0b5301: Pull complete
Digest: sha256:7b7b6aa414b68416bafaa08ed40bf89e03beadaaa774d211a492d0559ba129c2
Status: Downloaded newer image for composer:1
 ---> f77306b81c25
Step 14/18 : COPY ./php/scripts/*.sh /tmp/
 ---> b9a7ad716a5a
Step 15/18 : RUN chmod +x /tmp/*.sh
 ---> Running in ecff54a37161
Removing intermediate container ecff54a37161
 ---> 702278b71dd7
Step 16/18 : RUN bash ./packages.sh   && bash ./extensions.sh   && bash ./node.sh   && adduser --disabled-password --gecos "" $IMAGE_USER &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.profile &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.bashrc &&   echo "$IMAGE_USER  ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers &&   mkdir -p /var/www/html   && composer global require "hirak/prestissimo:^0.3"    && rm -rf ~/.composer/cache/*   && chown -R $IMAGE_USER:$IMAGE_USER /var/www $HOME   && curl -fsSL https://goss.rocks/install | GOSS_VER=v${GOSS_VERSION} sh   && bash ./cleanup.sh
 ---> Running in 1febc9615f5d
./packages.sh: line 2: $'\r': command not found
: invalid option name: set: pipefail
The command '/bin/sh -c bash ./packages.sh   && bash ./extensions.sh   && bash ./node.sh   && adduser --disabled-password --gecos "" $IMAGE_USER &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.profile &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.bashrc &&   echo "$IMAGE_USER  ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers &&   mkdir -p /var/www/html   && composer global require "hirak/prestissimo:^0.3"    && rm -rf ~/.composer/cache/*   && chown -R $IMAGE_USER:$IMAGE_USER /var/www $HOME   && curl -fsSL https://goss.rocks/install | GOSS_VER=v${GOSS_VERSION} sh   && bash ./cleanup.sh' returned a non-zero code: 2
edbizarro commented 3 years ago

Are u on windows? what your bash version and what terminal are you running this (Git Bash, Powershell, etc.)?

hanstsangcwc commented 3 years ago

I tried run on wsl2 or windows PowerShell and it didn't work.

not sure is it docker version or not. image image image

:/mnt/c/code/gitlab-ci-pipeline-php$ docker build --compress -f php/7.3/Dockerfile .
[+] Building 27.0s (11/12)
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 181B                                                                                  0.0s
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 1.64kB                                                                             0.0s
 => [internal] load metadata for docker.io/library/php:7.3                                                         3.2s
 => [stage-0 1/7] FROM docker.io/library/php:7.3@sha256:d31f88c1cdffe31a259d23b239e30668412956d6b4203e69eb96303f  22.6s
 => => resolve docker.io/library/php:7.3@sha256:d31f88c1cdffe31a259d23b239e30668412956d6b4203e69eb96303f2f2eb600   0.0s
 => => sha256:884b07cff889c32a1ceb41f75368ee7658c798b7b45d032e95b0beb1978b81e5 2.41kB / 2.41kB                     0.0s
 => => sha256:50f129e69384681ba8ea3ee79e4f9b69e8e7e8bcb00bac515ea5c9626d93ec3c 9.85kB / 9.85kB                     0.0s
 => => sha256:80f7a64e4b25ef4677013dcec51e1af42c22625c752488313e0861b1888c723a 226B / 226B                         0.5s
 => => sha256:da391f3e81f0b09c13ea57f5a07f660d6d704d6c2f03d7c0b550ea1cc7acf149 76.65MB / 76.65MB                  15.9s
 => => sha256:d31f88c1cdffe31a259d23b239e30668412956d6b4203e69eb96303f2f2eb600 1.86kB / 1.86kB                     0.0s
 => => sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90 27.09MB / 27.09MB                   6.5s
 => => sha256:8199ae3052e18f15705e0e05b817db237cae5bea84678ae2cbc0e9b88b2a2209 224B / 224B                         1.3s
 => => sha256:abf37c537f772bf2c77b94315402c9d26c3c76161fef2831ccef50ed8fb93a7e 12.46MB / 12.46MB                   5.9s
 => => sha256:1c570dbe62f18534228fb4ec072ca120534feb4fccc8e1fa8a78ebd4add0914a 491B / 491B                         6.2s
 => => sha256:2e8eed014328b831f5562d69ce8a861420ca7492da6980aeaff95fe6a9d48f07 28.70MB / 28.70MB                  12.1s
 => => extracting sha256:bb79b6b2107fea8e8a47133a660b78e3a546998fcf0427be39ac9a0af4a97e90                          1.2s
 => => sha256:7bcadf9ac796c71c4789d22304fed497153133ebb41cdd05a5651892356b5537 2.26kB / 2.26kB                     6.9s
 => => sha256:a5571b862acf41cfbbe6945b15c44da72fed2aa65d5b1eb79001ebfccb4ef53a 248B / 248B                         7.2s
 => => sha256:c67427299e872b3ac7a30b4aa0ad457326ec2ddeb5e1855005b9683f09715046 212B / 212B                         7.5s
 => => extracting sha256:80f7a64e4b25ef4677013dcec51e1af42c22625c752488313e0861b1888c723a                          0.0s
 => => extracting sha256:da391f3e81f0b09c13ea57f5a07f660d6d704d6c2f03d7c0b550ea1cc7acf149                          2.9s
 => => extracting sha256:8199ae3052e18f15705e0e05b817db237cae5bea84678ae2cbc0e9b88b2a2209                          0.0s
 => => extracting sha256:abf37c537f772bf2c77b94315402c9d26c3c76161fef2831ccef50ed8fb93a7e                          0.1s
 => => extracting sha256:1c570dbe62f18534228fb4ec072ca120534feb4fccc8e1fa8a78ebd4add0914a                          0.0s
 => => extracting sha256:2e8eed014328b831f5562d69ce8a861420ca7492da6980aeaff95fe6a9d48f07                          0.7s
 => => extracting sha256:7bcadf9ac796c71c4789d22304fed497153133ebb41cdd05a5651892356b5537                          0.0s
 => => extracting sha256:a5571b862acf41cfbbe6945b15c44da72fed2aa65d5b1eb79001ebfccb4ef53a                          0.0s
 => => extracting sha256:c67427299e872b3ac7a30b4aa0ad457326ec2ddeb5e1855005b9683f09715046                          0.0s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 8.82kB                                                                                0.1s
 => FROM docker.io/library/composer:1                                                                             18.1s
 => => resolve docker.io/library/composer:1                                                                        2.6s
 => => sha256:7b7b6aa414b68416bafaa08ed40bf89e03beadaaa774d211a492d0559ba129c2 1.65kB / 1.65kB                     0.0s
 => => sha256:8d37a3118fc4dc5408f014faab1c3d6f9fbed7322f2cf887443f1bff7e722f5d 3.46kB / 3.46kB                     0.0s
 => => sha256:188a16236e887c25c78d41d370c42db328384c126615c9ae5a845743862f94af 12.15kB / 12.15kB                   0.0s
 => => sha256:188c0c94c7c576fff0792aca7ec73d67a2f7f4cb3a6e53a84559337260b36964 2.80MB / 2.80MB                     6.5s
 => => extracting sha256:188c0c94c7c576fff0792aca7ec73d67a2f7f4cb3a6e53a84559337260b36964                          0.1s
 => => sha256:45f8bf6cfdbe614fef94f982905079c16e27b3de2d24eb1ff513d3d83e656ca2 1.34MB / 1.34MB                     7.6s
 => => extracting sha256:45f8bf6cfdbe614fef94f982905079c16e27b3de2d24eb1ff513d3d83e656ca2                          0.1s
 => => sha256:ce5be79740125b9e74a77885bf6ee2b0d25ac7ed9e9432c5aa7210bb3b00458a 1.23kB / 1.23kB                     7.9s
 => => extracting sha256:ce5be79740125b9e74a77885bf6ee2b0d25ac7ed9e9432c5aa7210bb3b00458a                          0.0s
 => => sha256:a99dd6507fe563b66ba35badf706e1bbb2d39eb5d0a3c0d5a86a45d2af7e89c1 221B / 221B                         8.5s
 => => extracting sha256:a99dd6507fe563b66ba35badf706e1bbb2d39eb5d0a3c0d5a86a45d2af7e89c1                          0.0s
 => => sha256:84ab7a98c2ef9382ba6cf0fc5a9987d6e32a81832e54241be956471c98ce2088 10.33MB / 10.33MB                  11.2s
 => => sha256:07fa46c284ad61140e5ce3ac01798895f0edecbbbce228b86ccfc667dad36d6b 498B / 498B                        10.3s
 => => sha256:7ae9397c88ea7dfdab00f9699013044c2631ee7c62c839411c1c111c3408c324 14.18MB / 14.18MB                  13.8s
 => => extracting sha256:84ab7a98c2ef9382ba6cf0fc5a9987d6e32a81832e54241be956471c98ce2088                          0.1s
 => => sha256:5e4748577090d68f9af19983928b0fb9fb2323318240fb214c4c7f1e2b42279b 2.26kB / 2.26kB                    11.6s
 => => extracting sha256:07fa46c284ad61140e5ce3ac01798895f0edecbbbce228b86ccfc667dad36d6b                          0.0s
 => => sha256:36fcf1c47c045c21c5c9a53d4cefd85e291836fcea324b721d0b802f566bb1c2 16.89kB / 16.89kB                  11.9s
 => => sha256:0e7ab985a9bda3eaa74105e5c5275bbb1907152463c919d389a6399eea368b41 33.86MB / 33.86MB                  16.2s
 => => extracting sha256:7ae9397c88ea7dfdab00f9699013044c2631ee7c62c839411c1c111c3408c324                          1.0s
 => => sha256:5d927604c025a4d1bc228608c30d3556822c5e59db33c49f1780e70976b68ca0 259B / 259B                        14.2s
 => => sha256:587323d75f78e9e8213c235befaccf69ddd6b86ec9b5677fab5e32709a3e181f 189.28kB / 189.28kB                14.2s
 => => sha256:c18a39bfedf9a3726d05562561a05759f516a243529febe753eb2f8ba3c8b7d4 509.76kB / 509.76kB                14.5s
 => => sha256:75dfe5229db855ac6db117334583c08ea818f375e83bb1b83289558eaf3173c8 407B / 407B                        14.5s
 => => sha256:33c89e0b53011c3908bea02eab88634d35840351688d73e4871350aa528096cf 92B / 92B                          14.8s
 => => extracting sha256:5e4748577090d68f9af19983928b0fb9fb2323318240fb214c4c7f1e2b42279b                          0.0s
 => => extracting sha256:36fcf1c47c045c21c5c9a53d4cefd85e291836fcea324b721d0b802f566bb1c2                          0.0s
 => => extracting sha256:0e7ab985a9bda3eaa74105e5c5275bbb1907152463c919d389a6399eea368b41                          1.0s
 => => extracting sha256:587323d75f78e9e8213c235befaccf69ddd6b86ec9b5677fab5e32709a3e181f                          0.0s
 => => extracting sha256:5d927604c025a4d1bc228608c30d3556822c5e59db33c49f1780e70976b68ca0                          0.0s
 => => extracting sha256:c18a39bfedf9a3726d05562561a05759f516a243529febe753eb2f8ba3c8b7d4                          0.1s
 => => extracting sha256:75dfe5229db855ac6db117334583c08ea818f375e83bb1b83289558eaf3173c8                          0.0s
 => => extracting sha256:33c89e0b53011c3908bea02eab88634d35840351688d73e4871350aa528096cf                          0.0s
 => [stage-0 2/7] WORKDIR /tmp                                                                                     0.1s
 => [stage-0 3/7] COPY --from=composer:1 /usr/bin/composer /usr/bin/composer                                       0.1s
 => [stage-0 4/7] COPY ./php/scripts/*.sh /tmp/                                                                    0.1s
 => [stage-0 5/7] RUN chmod +x /tmp/*.sh                                                                           0.3s
 => ERROR [stage-0 6/7] RUN bash ./packages.sh   && bash ./extensions.sh   && bash ./node.sh   && adduser --disab  0.4s
------
 > [stage-0 6/7] RUN bash ./packages.sh   && bash ./extensions.sh   && bash ./node.sh   && adduser --disabled-password --gecos "" php &&   echo "PATH=$(yarn global bin):/home/php/.yarn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /root/.profile &&   echo "PATH=$(yarn global bin):/home/php/.yarn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /root/.bashrc &&   echo "php  ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers &&   mkdir -p /var/www/html   && composer global require "hirak/prestissimo:^0.3"    && rm -rf ~/.composer/cache/*   && chown -R php:php /var/www /home/php   && curl -fsSL https://goss.rocks/install | GOSS_VER=v0.3.8 sh   && bash ./cleanup.sh:
#10 0.426 ./packages.sh: line 2: $'\r': command not found
: invalid option namesh: line 3: set: pipefail
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c bash ./packages.sh   && bash ./extensions.sh   && bash ./node.sh   && adduser --disabled-password --gecos "" $IMAGE_USER &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.profile &&   echo "PATH=$(yarn global bin):$PATH" >> /root/.bashrc &&   echo "$IMAGE_USER  ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers &&   mkdir -p /var/www/html   && composer global require "hirak/prestissimo:^0.3"    && rm -rf ~/.composer/cache/*   && chown -R $IMAGE_USER:$IMAGE_USER /var/www $HOME   && curl -fsSL https://goss.rocks/install | GOSS_VER=v${GOSS_VERSION} sh   && bash ./cleanup.sh]: runc did not terminate sucessfully