node.jsamazon-web-servicesjenkinsdockerless

Install node in Dockerfile?


I am user of AWS elastic beanstalk, and I have a little problem. I want to build my CSS files with less+node. But I don`t know how to install node in my dockerfile, when building with jenkins.

Here is installation packages what I am using in my docker. I will be glad for any suggestions.

FROM php:5.6-apache


# Install PHP5 and modules along with composer binary
RUN apt-get update
RUN apt-get -y install \
    curl \
    default-jdk \
    git \
    libcurl4-openssl-dev \
    libpq-dev \
    libmcrypt-dev \
    libpq5 \
    npm \
    node \
    zlib1g-dev \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libpng12-dev

RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

RUN docker-php-ext-install curl json mbstring opcache pdo_mysql zip gd exif sockets mcrypt

# Install pecl
RUN pecl install -o -f memcache-beta \
    && rm -rf /tmp/pear \
    && echo 'extension=memcache.so' > /usr/local/etc/php/conf.d/memcache.ini

After this I am runing my entrypoint.sh with code

#!/usr/bin/env sh

composer run-script post-install-cmd --no-interaction

chmod 0777 -R /var/app/app/cache
chmod 0777 -R /var/app/app/logs

exec apache2-foreground

But then I`ve got this error

 Error Output: [2016-04-04 11:23:44] assetic.ERROR: The template ":tmp:module.html.twig" contains an error: A template that extends another one cannot have a body in ":tmp:module.ht  
  ml.twig" at line 7.     

But when I install inside the Docker container node this way

apt-get install git-core curl build-essential openssl libssl-dev
 git clone https://github.com/nodejs/node.git
 cd node
 ./configure
 make
 sudo make install
 node -v

I can build my CSS. So question is..how this installation above make install inside my Dockerfile when I am building it with Jenkins?


Solution

  • Running apt-get install node does not install Node.js, because that's not the package you're asking for.

    If you run apt-cache info node you can see that what you are installing is a "Amateur Packet Radio Node program (transitional package)"

    You should follow the Node.js install instructions to install via package manager.

    Or if you like building from git, you can just do that inside Docker:

    RUN apt-get install -y git-core curl build-essential openssl libssl-dev \
     && git clone https://github.com/nodejs/node.git \
     && cd node \
     && ./configure \
     && make \
     && sudo make install