sanity-io / github-action-sanity

MIT License
57 stars 20 forks source link

Error in dockerfile: REGISTRY_DOMAIN, NPM_TOKEN etc are not set properly #17

Open antoine-sac opened 1 year ago

antoine-sac commented 1 year ago

There is a silent error in the dockerfile. It does not prevent the build but it's a bug for anyone relying on the behaviour to set a custom REGISTRY_DOMAIN.

The line in question is:

RUN if [[ -z "$NPM_SCOPE" && -z "$NPM_TOKEN" && -z "$REGISTRY_DOMAIN" ]]; \
    then \
    echo -e "//$REGISTRY_DOMAIN/:_authToken=$NPM_TOKEN\\n$NPM_SCOPE:registry=https://$REGISTRY_DOMAIN/" > .npmrc ; \
    fi

When building, this line fails, so effectively the build args REGISTRY_DOMAIN, NPM_TOKEN and NPM_SCOPE are ignored.

Build logs (cf step 15):

Step 14/17 : ARG REGISTRY_DOMAIN
 ---> Running in 4881[96](https://github.com/hestiia-engineering/ecommerce-backend-sanity/actions/runs/5156608732/jobs/9287830414#step:2:96)cf5011
Removing intermediate container 488196cf5011
 ---> 2eafbc358259
Step 15/17 : RUN if [[ -z "$NPM_SCOPE" && -z "$NPM_TOKEN" && -z "$REGISTRY_DOMAIN" ]];     then     echo -e "//$REGISTRY_DOMAIN/:_authToken=$NPM_TOKEN\\n$NPM_SCOPE:registry=https://$REGISTRY_DOMAIN/" > .npmrc ;     fi
 ---> Running in 79ee42191fbf
/bin/sh: 1: [[: not found
Removing intermediate container 79ee42191fbf
 ---> 38c5e1d5eb88
Step 16/17 : COPY entrypoint.sh /entrypoint.sh
 ---> 9292bab8fc07
Step 17/17 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Running in 696606a6dd73
Removing intermediate container 696606a6dd73
 ---> 4c5ebde6d258
Successfully built 4c5ebde6d258
Successfully tagged ed866e:a4e41192dabf4b21b910df695459aeac