Skip to content

Commit 3f1f60d

Browse files
authored
Merge pull request laradock#1412 from CantonBolo/optimize
Custom composer repo and npm registry url in php72
2 parents 21e3ef8 + e054b62 commit 3f1f60d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

workspace/Dockerfile-72

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
123123
composer global install \
124124
;fi
125125

126+
ARG COMPOSER_REPO_PACKAGIST
127+
ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST}
128+
129+
RUN if [ ${COMPOSER_REPO_PACKAGIST} ]; then \
130+
composer config -g repo.packagist composer ${COMPOSER_REPO_PACKAGIST} \
131+
;fi
132+
126133
#####################################
127134
# Crontab
128135
#####################################
@@ -302,13 +309,18 @@ ENV NODE_VERSION ${NODE_VERSION}
302309
ARG INSTALL_NODE=false
303310
ENV INSTALL_NODE ${INSTALL_NODE}
304311
ENV NVM_DIR /home/laradock/.nvm
312+
ARG NPM_REGISTRY
313+
ENV NPM_REGISTRY ${NPM_REGISTRY}
305314
RUN if [ ${INSTALL_NODE} = true ]; then \
306315
# Install nvm (A Node Version Manager)
307316
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash && \
308317
. $NVM_DIR/nvm.sh && \
309318
nvm install ${NODE_VERSION} && \
310319
nvm use ${NODE_VERSION} && \
311320
nvm alias ${NODE_VERSION} && \
321+
if [ ${NPM_REGISTRY} ]; then \
322+
npm config set registry ${NPM_REGISTRY} \
323+
;fi && \
312324
npm install -g gulp bower vue-cli \
313325
;fi
314326

@@ -332,6 +344,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
332344
# Add PATH for node
333345
ENV PATH $PATH:$NVM_DIR/versions/node/v${NODE_VERSION}/bin
334346

347+
RUN if [ ${NPM_REGISTRY} ]; then \
348+
. ~/.bashrc && npm config set registry ${NPM_REGISTRY} \
349+
;fi
335350

336351
#####################################
337352
# YARN:
@@ -442,6 +457,13 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
442457
#####################################
443458
USER root
444459

460+
ARG COMPOSER_REPO_PACKAGIST
461+
ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST}
462+
463+
RUN if [ ${COMPOSER_REPO_PACKAGIST} ]; then \
464+
composer config -g repo.packagist composer ${COMPOSER_REPO_PACKAGIST} \
465+
;fi
466+
445467
ARG INSTALL_LARAVEL_INSTALLER=false
446468
ENV INSTALL_LARAVEL_INSTALLER ${INSTALL_LARAVEL_INSTALLER}
447469

0 commit comments

Comments
 (0)