support custom composer repo url and npm registry url

This commit is contained in:
Bolo Lai 2018-02-21 13:13:19 +08:00
parent acbe7160d9
commit 4b5a1ef628
5 changed files with 72 additions and 0 deletions

View File

@ -23,12 +23,14 @@ services:
- INSTALL_PHPREDIS=${WORKSPACE_INSTALL_PHPREDIS} - INSTALL_PHPREDIS=${WORKSPACE_INSTALL_PHPREDIS}
- INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL} - INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH} - INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
- INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE} - INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE}
- INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE} - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}
- INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS} - INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS}
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL} - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
- COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
- INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH} - INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
- INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY} - INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
- INSTALL_LARAVEL_INSTALLER=${WORKSPACE_INSTALL_LARAVEL_INSTALLER} - INSTALL_LARAVEL_INSTALLER=${WORKSPACE_INSTALL_LARAVEL_INSTALLER}

View File

@ -67,12 +67,14 @@ WORKSPACE_INSTALL_AMQP=false
WORKSPACE_INSTALL_PHPREDIS=false WORKSPACE_INSTALL_PHPREDIS=false
WORKSPACE_INSTALL_MSSQL=false WORKSPACE_INSTALL_MSSQL=false
WORKSPACE_INSTALL_NODE=false WORKSPACE_INSTALL_NODE=false
WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_YARN=false WORKSPACE_INSTALL_YARN=false
WORKSPACE_INSTALL_DRUSH=false WORKSPACE_INSTALL_DRUSH=false
WORKSPACE_INSTALL_DRUPAL_CONSOLE=false WORKSPACE_INSTALL_DRUPAL_CONSOLE=false
WORKSPACE_INSTALL_AEROSPIKE=false WORKSPACE_INSTALL_AEROSPIKE=false
WORKSPACE_INSTALL_V8JS=false WORKSPACE_INSTALL_V8JS=false
WORKSPACE_COMPOSER_GLOBAL_INSTALL=false WORKSPACE_COMPOSER_GLOBAL_INSTALL=false
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_INSTALL_WORKSPACE_SSH=false WORKSPACE_INSTALL_WORKSPACE_SSH=false
WORKSPACE_INSTALL_LARAVEL_ENVOY=false WORKSPACE_INSTALL_LARAVEL_ENVOY=false
WORKSPACE_INSTALL_LARAVEL_INSTALLER=false WORKSPACE_INSTALL_LARAVEL_INSTALLER=false

View File

@ -127,6 +127,13 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \ composer global install \
;fi ;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
# Export composer vendor path # Export composer vendor path
RUN echo "" >> ~/.bashrc && \ RUN echo "" >> ~/.bashrc && \
echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc
@ -309,6 +316,8 @@ ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION} ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=false ARG INSTALL_NODE=false
ENV INSTALL_NODE ${INSTALL_NODE} ENV INSTALL_NODE ${INSTALL_NODE}
ARG NPM_REGISTRY
ENV NPM_REGISTRY ${NPM_REGISTRY}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
@ -317,6 +326,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
nvm install ${NODE_VERSION} && \ nvm install ${NODE_VERSION} && \
nvm use ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \
nvm alias ${NODE_VERSION} && \ nvm alias ${NODE_VERSION} && \
if [ ${NPM_REGISTRY} ]; then \
npm config set registry ${NPM_REGISTRY} \
;fi && \
npm install -g gulp bower vue-cli \ npm install -g gulp bower vue-cli \
;fi ;fi
@ -340,6 +352,10 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
# Add PATH for node # Add PATH for node
ENV PATH $PATH:$NVM_DIR/versions/node/v${NODE_VERSION}/bin 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: # YARN:
##################################### #####################################
@ -428,6 +444,13 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
##################################### #####################################
USER root 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=true ARG INSTALL_LARAVEL_INSTALLER=true
ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER} ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER}

View File

@ -124,6 +124,13 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \ composer global install \
;fi ;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
# Export composer vendor path # Export composer vendor path
RUN echo "" >> ~/.bashrc && \ RUN echo "" >> ~/.bashrc && \
echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc
@ -305,6 +312,8 @@ ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION} ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=false ARG INSTALL_NODE=false
ENV INSTALL_NODE ${INSTALL_NODE} ENV INSTALL_NODE ${INSTALL_NODE}
ARG NPM_REGISTRY
ENV NPM_REGISTRY ${NPM_REGISTRY}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
@ -313,6 +322,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
nvm install ${NODE_VERSION} && \ nvm install ${NODE_VERSION} && \
nvm use ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \
nvm alias ${NODE_VERSION} && \ nvm alias ${NODE_VERSION} && \
if [ ${NPM_REGISTRY} ]; then \
npm config set registry ${NPM_REGISTRY} \
;fi && \
npm install -g gulp bower vue-cli \ npm install -g gulp bower vue-cli \
;fi ;fi
@ -336,6 +348,10 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
# Add PATH for node # Add PATH for node
ENV PATH $PATH:$NVM_DIR/versions/node/v${NODE_VERSION}/bin 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: # YARN:
##################################### #####################################
@ -441,6 +457,13 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
##################################### #####################################
USER root 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=true ARG INSTALL_LARAVEL_INSTALLER=true
ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER} ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER}

View File

@ -123,6 +123,13 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
composer global install \ composer global install \
;fi ;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 # Crontab
##################################### #####################################
@ -301,6 +308,8 @@ ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION} ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=false ARG INSTALL_NODE=false
ENV INSTALL_NODE ${INSTALL_NODE} ENV INSTALL_NODE ${INSTALL_NODE}
ARG NPM_REGISTRY
ENV NPM_REGISTRY ${NPM_REGISTRY}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
@ -309,6 +318,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
nvm install ${NODE_VERSION} && \ nvm install ${NODE_VERSION} && \
nvm use ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \
nvm alias ${NODE_VERSION} && \ nvm alias ${NODE_VERSION} && \
if [ ${NPM_REGISTRY} ]; then \
npm config set registry ${NPM_REGISTRY} \
;fi && \
npm install -g gulp bower vue-cli \ npm install -g gulp bower vue-cli \
;fi ;fi
@ -332,6 +344,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
# Add PATH for node # Add PATH for node
ENV PATH $PATH:$NVM_DIR/versions/node/v${NODE_VERSION}/bin 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: # YARN:
@ -442,6 +457,13 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
##################################### #####################################
USER root 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 ARG INSTALL_LARAVEL_INSTALLER=false
ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER} ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER}