2017-02-02 113 views
0

Dockerfile的以下部分安裝節點,但默認到v 4.2.6,如何安裝最新的穩定版本7.4.0安裝的NodeJS的最新穩定版本Dockerfile

RUN apt-get clean && apt-get update \ 
    && apt-get -yqq install \ 
    apache2 \ 
    nodejs \ ## nodejs installed here 
    php \ 
    php-mcrypt \ 
    php-curl \ 
    php-mbstring \ 
    php-xml \ 
    php-zip \ 
    libapache2-mod-php \ 
    php-mysql \ 
    git \ 
    supervisor \ 
    && apt-get -y autoremove \ 
    && apt-get clean \ 
    && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ 
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ 
    && ln -sf /dev/stdout /var/log/apache2/access.log \ 
    && ln -sf /dev/stderr /var/log/apache2/error.log 

回答

0

據文檔nodejs.org你可以這樣安裝:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs

所以,你可以Dockerfile是這樣的:

RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash \ && apt-get clean && apt-get update \ && apt-get -yqq install \ apache2 \ nodejs \ ## It should be the good version

0
RUN apt-get clean && apt-get update \ 
    && apt-get -yqq install \ 
    apache2 \ 
    php \ 
    php-mcrypt \ 
    php-curl \ 
    php-mbstring \ 
    php-xml \ 
    php-zip \ 
    libapache2-mod-php \ 
    php-mysql \ 
    git \ 
    supervisor \ 
    && apt-get -y autoremove \ 
    && apt-get clean \ 
    && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ 
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ 
    && ln -sf /dev/stdout /var/log/apache2/access.log \ 
    && ln -sf /dev/stderr /var/log/apache2/error.log \ 
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash && nvm install 7.4.0 \ 
    && nvm use 7.4.0 \