如何在Dockerfile中运行bower安装?
我用我的应用程序的前端后端和angularjs,并能够运行前端,我应该先运行凉亭安装。
注意:我正在从一个centos7基础图像构build我的图像。
我试图把它添加到运行命令的docker文件中
WORDIR ./Frontend RUN bower install
我得到一个错误:
/bin/sh: bower: command not found
有谁知道我怎么解决这个问题?
这是一个完整的例子,如何为docker安装centos
Dockerfile
FROM centos RUN useradd -ms /bin/bash bower RUN yum install -y gcc-c++ make RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - RUN yum install -y nodejs # install bower RUN npm install --global bower USER bower #this should show bower help - try to use install instead RUN bower help
而在这个docker形象的build设阶段,你应该看到下面的东西。 它表明(在构build阶段),您已经成功安装了凉亭。
尝试改变帮助 安装 ,并添加您的docker命令 – WORDIR ./Frontend
等。
Step 8 : RUN bower help ---> Running in 2afd81510166 Usage: bower <command> [<args>] [<options>] Commands: cache Manage bower cache help Display help information about Bower home Opens a package homepage into your favorite browser
你应该看看https://github.com/marmelab/docker-bower/blob/master/Dockerfile
我看到,除其他外
RUN apt-get install -y -qq npm RUN ln -s /usr/bin/nodejs /usr/bin/node # install bower RUN npm install --global bower
首先,你需要检查你的机器是否全局安装在你的机器上。 比你可以用凉亭安装包。
你可以用命令安装:npm install bower -g