Angad Dubey
Angad Dubey

Reputation: 5452

Installing the most recent stable version of nodejs Dockerfile

The following portion of Dockerfile installs node, but defaults to v.4.2.6, How do I install the most recent stable version 7.4.0:

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

Upvotes: 1

Views: 463

Answers (2)

owais
owais

Reputation: 4922

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 \

Upvotes: 0

Max
Max

Reputation: 326

According to the documentation from nodejs.org you can install it by doing this :

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

So your Dockerfile could be like this :

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

Upvotes: 2

Related Questions