From e054b622f3e1528c4d5897788b7d4f9ab08ae99c Mon Sep 17 00:00:00 2001 From: Bolo Lai Date: Mon, 5 Mar 2018 02:08:11 +0800 Subject: [PATCH] Custom composer repo and npm registry url in php72 --- workspace/Dockerfile-72 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/workspace/Dockerfile-72 b/workspace/Dockerfile-72 index bb646df..9f4a965 100644 --- a/workspace/Dockerfile-72 +++ b/workspace/Dockerfile-72 @@ -123,6 +123,13 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ composer global install \ ;fi +ARG COMPOSER_REPO_PACKAGIST +ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST} + +RUN if [ ${COMPOSER_REPO_PACKAGIST} ]; then \ + composer config -g repo.packagist composer ${COMPOSER_REPO_PACKAGIST} \ +;fi + ##################################### # Crontab ##################################### @@ -302,6 +309,8 @@ ENV NODE_VERSION ${NODE_VERSION} ARG INSTALL_NODE=false ENV INSTALL_NODE ${INSTALL_NODE} ENV NVM_DIR /home/laradock/.nvm +ARG NPM_REGISTRY +ENV NPM_REGISTRY ${NPM_REGISTRY} RUN if [ ${INSTALL_NODE} = true ]; then \ # Install nvm (A Node Version Manager) curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash && \ @@ -309,6 +318,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \ nvm install ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \ nvm alias ${NODE_VERSION} && \ + if [ ${NPM_REGISTRY} ]; then \ + npm config set registry ${NPM_REGISTRY} \ + ;fi && \ npm install -g gulp bower vue-cli \ ;fi @@ -332,6 +344,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \ # Add PATH for node ENV PATH $PATH:$NVM_DIR/versions/node/v${NODE_VERSION}/bin +RUN if [ ${NPM_REGISTRY} ]; then \ + . ~/.bashrc && npm config set registry ${NPM_REGISTRY} \ +;fi ##################################### # YARN: @@ -442,6 +457,13 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \ ##################################### USER root +ARG COMPOSER_REPO_PACKAGIST +ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST} + +RUN if [ ${COMPOSER_REPO_PACKAGIST} ]; then \ + composer config -g repo.packagist composer ${COMPOSER_REPO_PACKAGIST} \ +;fi + ARG INSTALL_LARAVEL_INSTALLER=false ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER}