在Dockerfile中安装节点?

我是AWS elastic beanstalk的用户,我有一个小问题。 我想用更less的+节点来构build我的CSS文件。 但是当我用jenkins构build时,我不知道如何在我的dockerfile中安装节点。

这里是我在docker中使用的安装包。 我会很高兴的任何build议。

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 

在这之后,我用代码运行我的entrypoint.sh

 #!/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 

但是,我有这个错误

  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. 

但是当我以这种方式安装在Docker容器节点内时

 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 

我可以build立我的CSS。 所以问题是,当我与Jenkins一起构build时,如何安装上面的代码使我的Dockerfile安装在内?

运行apt-get install node 不会安装Node.js ,因为这不是您要求的软件包。

如果你运行apt-cache info node你可以看到你正在安装的是“业余无线分组无线节点程序(过渡包)”

你应该遵循Node.js安装说明通过包pipe理器来安装。

或者如果你喜欢用git构build,你可以在Docker里面做:

 RUN 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